From 0cf0753e5ba309e7ce7a6f38886664e89752ab8f Mon Sep 17 00:00:00 2001 From: Joakim Repomaa Date: Sat, 8 Feb 2025 14:35:59 +0200 Subject: [PATCH] refactor --- flake.lock | 37 +++++++++++++++++++++++++++++++--- flake.nix | 59 ++++++++++++++++++++++++++++-------------------------- 2 files changed, 65 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index fc29929..b7c35d1 100644 --- a/flake.lock +++ b/flake.lock @@ -71,6 +71,24 @@ "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, + "locked": { + "lastModified": 1738453229, + "narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, "locked": { "lastModified": 1719877454, "narHash": "sha256-g5N1yyOSsPNiOlFfkuI/wcUjmtah+nxdImJqrSATjOU=", @@ -85,7 +103,7 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "lanzaboote", @@ -220,7 +238,7 @@ }, "gtrackmap": { "inputs": { - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "frontend": "frontend", "nixpkgs": [ "nixpkgs" @@ -318,7 +336,7 @@ "inputs": { "crane": "crane", "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "nixpkgs": "nixpkgs_3", "pre-commit-hooks-nix": "pre-commit-hooks-nix", "rust-overlay": "rust-overlay" @@ -410,6 +428,18 @@ } }, "nixpkgs-lib": { + "locked": { + "lastModified": 1738452942, + "narHash": "sha256-vJzFZGaCpnmo7I6i416HaBLpC+hvcURh/BQwROcGIp8=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" + } + }, + "nixpkgs-lib_2": { "locked": { "lastModified": 1719876945, "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", @@ -566,6 +596,7 @@ "inputs": { "auto-cpufreq": "auto-cpufreq", "commander-nvim": "commander-nvim", + "flake-parts": "flake-parts", "gen-nvim": "gen-nvim", "gtrackmap": "gtrackmap", "home-manager": "home-manager", diff --git a/flake.nix b/flake.nix index 60a7dc8..763a868 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,6 @@ { inputs = { + flake-parts.url = "github:hercules-ci/flake-parts"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; nextcloud = { @@ -48,36 +49,38 @@ }; ksoloti-pr.url = "github:repomaa/nixpkgs/pkg/ksoloti"; }; - outputs = { nixpkgs, ... }@inputs: - let - bin.sshPort = 2222; - ssh.publicKeys.yubikey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIUkESu5NnBi1M0+ZjYrkp6/rIFuwc3aguspf98jmOydNce6l65cnS3GRzc9oWx4lu11ahi87ZuE+pYV+gaHm4="; - specialArgs = { inherit inputs bin ssh; }; - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in - { - devShells.${system}.default = pkgs.mkShell { - packages = with pkgs; [ - nix-output-monitor - ]; - }; - nixosConfigurations = { - freun-dev = nixpkgs.lib.nixosSystem { - inherit specialArgs; - system = "aarch64-linux"; - modules = [ ./modules ./hosts/freun.dev ]; + outputs = { flake-parts, nixpkgs, ... }@inputs: + flake-parts.lib.mkFlake { inherit inputs; } ( + let + ssh.publicKeys.yubikey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIUkESu5NnBi1M0+ZjYrkp6/rIFuwc3aguspf98jmOydNce6l65cnS3GRzc9oWx4lu11ahi87ZuE+pYV+gaHm4="; + specialArgs = { inherit inputs ssh; }; + inherit (nixpkgs) lib; + in + { + systems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + perSystem = { pkgs, ... }: { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + nix-output-monitor + ]; + }; }; + flake.nixosConfigurations = { + freun-dev = lib.nixosSystem { + inherit specialArgs; + modules = [ ./modules ./hosts/freun.dev ]; + }; - radish = nixpkgs.lib.nixosSystem { - inherit system specialArgs; - modules = [ ./modules ./hosts/radish ]; - }; + radish = lib.nixosSystem { + inherit specialArgs; + modules = [ ./modules ./hosts/radish ]; + }; - apu = nixpkgs.lib.nixosSystem { - inherit system specialArgs; - modules = [ ./modules ./hosts/apu ]; + apu = nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = [ ./modules ./hosts/apu ]; + }; }; - }; - }; + } + ); }