diff --git a/flake.lock b/flake.lock index 31a6e49..0b7f4e6 100644 --- a/flake.lock +++ b/flake.lock @@ -89,6 +89,21 @@ } }, "crane": { + "locked": { + "lastModified": 1763938834, + "narHash": "sha256-j8iB0Yr4zAvQLueCZ5abxfk6fnG/SJ5JnGUziETjwfg=", + "owner": "ipetkov", + "repo": "crane", + "rev": "d9e753122e51cee64eb8d2dddfe11148f339f5a2", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "crane_2": { "locked": { "lastModified": 1760924934, "narHash": "sha256-tuuqY5aU7cUkR71sO2TraVKK2boYrdW3gCSXUkF4i44=", @@ -241,6 +256,27 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "harmonia", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1763759067, + "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -427,6 +463,31 @@ "type": "github" } }, + "harmonia": { + "inputs": { + "crane": "crane", + "flake-parts": "flake-parts", + "nix": "nix", + "nixpkgs": [ + "nixpkgs-unstable" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1765032623, + "narHash": "sha256-BbtN5NFN2RU3KP2TLA6zOoiv5MZXWqN1mXxIkKY8Kx4=", + "owner": "devplayer0", + "repo": "harmonia", + "rev": "310e2b2c6583710c52531785f1245d9621284310", + "type": "github" + }, + "original": { + "owner": "devplayer0", + "ref": "cache-config-daemon-store", + "repo": "harmonia", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -519,6 +580,22 @@ "type": "github" } }, + "nix": { + "flake": false, + "locked": { + "lastModified": 1764532838, + "narHash": "sha256-hw4J7wfqXWBCvsMVXPS4nvkcSeTXAtR5h9Ylv7a7dBA=", + "owner": "nixos", + "repo": "nix", + "rev": "8be9507a88f466dd44e6e56cd00167fa10e995b8", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nix", + "type": "github" + } + }, "nixGL": { "inputs": { "flake-utils": "flake-utils_7", @@ -704,7 +781,7 @@ "ragenix": { "inputs": { "agenix": "agenix", - "crane": "crane", + "crane": "crane_2", "flake-utils": "flake-utils_8", "nixpkgs": [ "nixpkgs-unstable" @@ -734,6 +811,7 @@ "deploy-rs": "deploy-rs", "devshell": "devshell_3", "flake-utils": "flake-utils_6", + "harmonia": "harmonia", "home-manager-stable": "home-manager-stable", "home-manager-unstable": "home-manager-unstable", "impermanence": "impermanence", @@ -945,6 +1023,27 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "harmonia", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1761311587, + "narHash": "sha256-Msq86cR5SjozQGCnC6H8C+0cD4rnx91BPltZ9KK613Y=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "2eddae033e4e74bf581c2d1dfa101f9033dbd2dc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "utils": { "inputs": { "systems": "systems_3" diff --git a/flake.nix b/flake.nix index cdbef6d..e3eb009 100644 --- a/flake.nix +++ b/flake.nix @@ -34,6 +34,9 @@ boardie.inputs.nixpkgs.follows = "nixpkgs-unstable"; nixGL.url = "github:nix-community/nixGL"; nixGL.inputs.nixpkgs.follows = "nixpkgs-unstable"; + # harmonia.url = "github:nix-community/harmonia"; + harmonia.url = "github:devplayer0/harmonia/cache-config-daemon-store"; + harmonia.inputs.nixpkgs.follows = "nixpkgs-unstable"; # Packages not in nixpkgs sharry.url = "github:eikek/sharry"; diff --git a/nixos/boxes/colony/vms/shill/containers/object.nix b/nixos/boxes/colony/vms/shill/containers/object.nix index 7c5697f..779f361 100644 --- a/nixos/boxes/colony/vms/shill/containers/object.nix +++ b/nixos/boxes/colony/vms/shill/containers/object.nix @@ -89,12 +89,17 @@ in { users = { harmonia = { + isSystemUser = true; + group = "harmonia"; shell = pkgs.bashInteractive; openssh.authorizedKeys.keyFiles = [ lib.my.c.sshKeyFiles.harmonia ]; }; }; + groups = { + harmonia = { }; + }; } ]; @@ -127,13 +132,24 @@ in }; } ]; - harmonia = { - environment.NIX_REMOTE = "/var/lib/harmonia"; + + harmonia-dev = { + # environment.RUST_LOG = mkForce "trace"; + # serviceConfig = { + # StateDirectory = "harmonia"; + # DynamicUser = mkForce false; + # }; + }; + harmonia-daemon = { + # environment.RUST_LOG = mkForce "trace"; preStart = '' - ${config.nix.package}/bin/nix store ping + ${config.nix.package}/bin/nix store info --store /var/lib/harmonia ''; serviceConfig = { + User = "harmonia"; + Group = "harmonia"; StateDirectory = "harmonia"; + DynamicUser = mkForce false; }; }; }; @@ -235,11 +251,20 @@ in }; }; - harmonia = { - enable = true; - signKeyPaths = [ config.age.secrets."nix-cache.key".path ]; - settings = { - priority = 30; + harmonia-dev = { + daemon = { + enable = true; + storeDir = "/nix/store"; + dbPath = "/var/lib/harmonia/nix/var/nix/db/db.sqlite"; + }; + cache = { + enable = true; + signKeyPaths = [ config.age.secrets."nix-cache.key".path ]; + settings = { + priority = 30; + daemon_store = "/nix/store"; + real_nix_store = "/var/lib/harmonia/nix/store"; + }; }; }; diff --git a/nixos/modules/common.nix b/nixos/modules/common.nix index 7a2ad81..0873a04 100644 --- a/nixos/modules/common.nix +++ b/nixos/modules/common.nix @@ -9,10 +9,11 @@ in }; imports = [ - inputs.impermanence.nixosModule + inputs.impermanence.nixosModules.default inputs.ragenix.nixosModules.age inputs.sharry.nixosModules.default inputs.copyparty.nixosModules.default + inputs.harmonia.nixosModules.harmonia ]; config = mkMerge [