[TASK] Add nix-flatpak as flake

This commit is contained in:
Sebastian Fischer 2026-04-14 20:38:37 +02:00
parent 516203ba38
commit 394e26e2ac
5 changed files with 124 additions and 10 deletions

View File

@ -9,7 +9,8 @@ SHELL := $(shell which bash)
.PHONY: sync
sync:
sudo rsync -a --exclude='hardware-configuration.nix' nixos/ /etc/nixos/
sudo nixos-rebuild switch
sudo nixos-rebuild switch --flake /etc/nixos#cesium
sudo cp /etc/nixos/flake.lock nixos/flake.lock 2>/dev/null || true
.PHONY: sync-dry-run
@ -25,7 +26,9 @@ add-pre-commit-hook:
.PHONY: upgrade
upgrade:
nixos-rebuild switch --upgrade-all --sudo
sudo nix flake update /etc/nixos
sudo nixos-rebuild switch --flake /etc/nixos#cesium
sudo cp /etc/nixos/flake.lock nixos/flake.lock 2>/dev/null || true
.PHONY: cleanup
cleanup:

View File

@ -112,10 +112,19 @@
# Enable CUPS to print documents.
services.printing.enable = true;
services.flatpak.enable = true;
services.flatpak.remotes = [{
name = "flathub";
location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
}];
services.flatpak.packages = [
{ appId = "com.snes9x.Snes9x"; origin = "flathub"; }
];
system.autoUpgrade = {
enable = true;
allowReboot = false;
channel = "https://channels.nixos.org/nixos-25.11";
flake = "/etc/nixos#cesium";
};
nix.gc = {

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, pkgs, nixpkgs-unstable, ... }:
{
imports = [
@ -9,7 +9,6 @@
./mounts.nix
./services.nix
./users/sebastian.nix
<home-manager/nixos>
];
# Home Manager configuration
@ -23,11 +22,7 @@
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
(final: prev: {
rustdesk-flutter =
let
unstable = import <nixos-unstable> { config = prev.config; };
in
unstable.rustdesk-flutter;
rustdesk-flutter = nixpkgs-unstable.legacyPackages.${prev.stdenv.hostPlatform.system}.rustdesk-flutter;
})
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];

82
nixos/flake.lock generated Normal file
View File

@ -0,0 +1,82 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1775425411,
"narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-25.11",
"repo": "home-manager",
"type": "github"
}
},
"nix-flatpak": {
"locked": {
"lastModified": 1768656715,
"narHash": "sha256-Sbh037scxKFm7xL0ahgSCw+X2/5ZKeOwI2clqrYr9j4=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "123fe29340a5b8671367055b75a6e7c320d6f89a",
"type": "github"
},
"original": {
"owner": "gmodena",
"repo": "nix-flatpak",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1776067740,
"narHash": "sha256-B35lpsqnSZwn1Lmz06BpwF7atPgFmUgw1l8KAV3zpVQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7e495b747b51f95ae15e74377c5ce1fe69c1765f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-25.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1775710090,
"narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4c1018dae018162ec878d42fec712642d214fdfa",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nix-flatpak": "nix-flatpak",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
}
}
},
"root": "root",
"version": 7
}

25
nixos/flake.nix Normal file
View File

@ -0,0 +1,25 @@
{
description = "NixOS configuration for cesium";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-flatpak.url = "github:gmodena/nix-flatpak";
};
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, nix-flatpak }: {
nixosConfigurations.cesium = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit nixpkgs-unstable; };
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
nix-flatpak.nixosModules.nix-flatpak
];
};
};
}