From f898ce3eae9f4cba092d4b83e6dcca2b9847edcc Mon Sep 17 00:00:00 2001 From: Fabian Hauser Date: Sun, 2 Mar 2025 22:27:25 +0200 Subject: [PATCH] Migrate to nix-fast-build and update inputs --- .github/actions/attic-cache/action.yml | 15 ----------- .github/workflows/ci.yml | 11 ++------ flake.lock | 32 ++++++++++++------------ flake.nix | 26 +++++++++++++++++-- nixos-configurations/speer/default.nix | 16 ------------ nixos-modules/base-system/default.nix | 1 - nixos-modules/default.nix | 1 + nixos-modules/virtualisation/default.nix | 18 +++++++++++++ 8 files changed, 61 insertions(+), 59 deletions(-) delete mode 100644 .github/actions/attic-cache/action.yml create mode 100644 nixos-modules/virtualisation/default.nix diff --git a/.github/actions/attic-cache/action.yml b/.github/actions/attic-cache/action.yml deleted file mode 100644 index 5a0a5f2..0000000 --- a/.github/actions/attic-cache/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: "Attic Watch and Push" -description: "Composite action pushes results after the job completes. Needs prior attic-cache action to have executed successfully." - -inputs: - cache_repository: - description: "Cache repository to use with attic" - required: true - -runs: - using: "composite" - steps: - - name: Attic Push Results - shell: "nix shell nixpkgs#attic-client --command {0}" - run: | - attic push "${{ inputs.cache_repository }}" "./result" # TODO: Make this smarter diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b5ad95..b786aac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,13 +27,6 @@ jobs: attic_auth_token: ${{ secrets.ATTIC_AUTH_TOKEN }} cache_repository: fabianhauser:dotfiles - - name: Build - run: nix build --max-jobs 12 --cores 12 - - name: Run Checks - run: nix flake check - - - name: Setup Cache Push - uses: ./.github/actions/attic-cache-push - with: - cache_repository: fabianhauser:dotfiles + shell: nix develop --command bash -c "{0}" + run: nix-fast-build --skip-cached --attic-cache fabianhauser:dotfiles diff --git a/flake.lock b/flake.lock index ec9574a..c6f15e0 100644 --- a/flake.lock +++ b/flake.lock @@ -72,11 +72,11 @@ ] }, "locked": { - "lastModified": 1739841949, - "narHash": "sha256-lSOXdgW/1zi/SSu7xp71v+55D5Egz8ACv0STkj7fhbs=", + "lastModified": 1740485968, + "narHash": "sha256-WK+PZHbfDjLyveXAxpnrfagiFgZWaTJglewBWniTn2Y=", "owner": "nix-community", "repo": "disko", - "rev": "15dbf8cebd8e2655a883b74547108e089f051bf0", + "rev": "19c1140419c4f1cdf88ad4c1cfb6605597628940", "type": "github" }, "original": { @@ -217,11 +217,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1738453229, - "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "lastModified": 1740872218, + "narHash": "sha256-ZaMw0pdoUKigLpv9HiNDH2Pjnosg7NBYMJlHTIsHEUo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "rev": "3876f6b87db82f33775b1ef5ea343986105db764", "type": "github" }, "original": { @@ -326,11 +326,11 @@ ] }, "locked": { - "lastModified": 1740161709, - "narHash": "sha256-QInyU5nXiwGzzCc3qxYHJKFY/YWege8Us7aZZOCFW4Q=", + "lastModified": 1740845322, + "narHash": "sha256-AXEgFj3C0YJhu9k1OhbRhiA6FnDr81dQZ65U3DhaWpw=", "owner": "nix-community", "repo": "home-manager", - "rev": "148a6b55651ac794f5c20bbd76780b4d8fed4334", + "rev": "fcac3d6d88302a5e64f6cb8014ac785e08874c8d", "type": "github" }, "original": { @@ -414,14 +414,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1738452942, - "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=", + "lastModified": 1740872140, + "narHash": "sha256-3wHafybyRfpUCLoE8M+uPVZinImg3xX+Nm6gEfN3G8I=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" } }, "nixpkgs-stable": { @@ -442,11 +442,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1739866667, - "narHash": "sha256-EO1ygNKZlsAC9avfcwHkKGMsmipUk1Uc0TbrEZpkn64=", + "lastModified": 1740828860, + "narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "73cf49b8ad837ade2de76f87eb53fc85ed5d4680", + "rev": "303bd8071377433a2d8f76e684ec773d70c5b642", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index dfd99d4..75815e3 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,12 @@ }; outputs = - inputs@{ flake-parts, nixpkgs, ... }: + inputs@{ + flake-parts, + nixpkgs, + self, + ... + }: flake-parts.lib.mkFlake { inherit inputs; } { imports = map (name: inputs.${name}.flakeModule) [ "treefmt-nix" @@ -60,7 +65,12 @@ "x86_64-linux" ]; perSystem = - { pkgs, lib, ... }: + { + pkgs, + lib, + self', + ... + }: { treefmt = { programs = { @@ -70,12 +80,24 @@ settings.global.excludes = [ "*.jpg" ]; }; + checks = + with lib; + concatMapAttrs + (typeName: concatMapAttrs (objectName: value: { "${typeName}-${objectName}" = value; })) + { + inherit (self') devShells; + nixosConfigurations = mapAttrs ( + _name: value: value.config.system.build.toplevel + ) self.nixosConfigurations; + }; + devShells.default = pkgs.mkShell { name = "nix-config-default-shell"; packages = lib.attrValues { inherit (pkgs) nixos-rebuild nixos-facter + nix-fast-build attic-client sops ssh-to-age diff --git a/nixos-configurations/speer/default.nix b/nixos-configurations/speer/default.nix index 25a1fba..2a27575 100644 --- a/nixos-configurations/speer/default.nix +++ b/nixos-configurations/speer/default.nix @@ -8,22 +8,6 @@ ]; facter.reportPath = ./facter.json; - virtualisation = { - # TODO: This should probably be somewhere else. - docker = { - enable = true; - enableOnBoot = false; - }; - libvirtd.enable = true; - spiceUSBRedirection.enable = true; - }; - - boot.extraModprobeConfig = '' - options kvm_intel nested=1 - options kvm_intel emulate_invalid_guest_state=0 - options kvm ignore_msrs=1 - ''; - # Set your time zone. time.timeZone = "Europe/Tallinn"; diff --git a/nixos-modules/base-system/default.nix b/nixos-modules/base-system/default.nix index d0670c2..e65ab74 100644 --- a/nixos-modules/base-system/default.nix +++ b/nixos-modules/base-system/default.nix @@ -12,7 +12,6 @@ pkgs.sbctl ]; - boot.loader.efi.canTouchEfiVariables = true; boot.initrd.systemd.enable = true; diff --git a/nixos-modules/default.nix b/nixos-modules/default.nix index 73677d1..344d556 100644 --- a/nixos-modules/default.nix +++ b/nixos-modules/default.nix @@ -9,5 +9,6 @@ ./home-manager ./printing ./theme + ./virtualisation ]; } diff --git a/nixos-modules/virtualisation/default.nix b/nixos-modules/virtualisation/default.nix new file mode 100644 index 0000000..d5d9392 --- /dev/null +++ b/nixos-modules/virtualisation/default.nix @@ -0,0 +1,18 @@ +{ ... }: +{ + virtualisation = { + # TODO: This should probably be somewhere else. + docker = { + enable = true; + enableOnBoot = false; + }; + libvirtd.enable = true; + spiceUSBRedirection.enable = true; + }; + + boot.extraModprobeConfig = '' + options kvm_intel nested=1 + options kvm_intel emulate_invalid_guest_state=0 + options kvm ignore_msrs=1 + ''; +}