diff --git a/Makefile b/Makefile index ca916ab..ae050cc 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/nixos/common.nix b/nixos/common.nix index 096843b..6e95eb2 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -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 = { diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 0a929ef..cf3a801 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, nixpkgs-unstable, ... }: { imports = [ @@ -9,7 +9,6 @@ ./mounts.nix ./services.nix ./users/sebastian.nix - ]; # Home Manager configuration @@ -23,11 +22,7 @@ nixpkgs.config.allowUnfree = true; nixpkgs.overlays = [ (final: prev: { - rustdesk-flutter = - let - unstable = import { 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" ]; diff --git a/nixos/flake.lock b/nixos/flake.lock new file mode 100644 index 0000000..383b55c --- /dev/null +++ b/nixos/flake.lock @@ -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 +} diff --git a/nixos/flake.nix b/nixos/flake.nix new file mode 100644 index 0000000..eb02a1f --- /dev/null +++ b/nixos/flake.nix @@ -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 + ]; + }; + }; +} \ No newline at end of file