Skip to content

Commit

Permalink
Improve compatibility for home-manager modules
Browse files Browse the repository at this point in the history
  • Loading branch information
elpdt852 committed Feb 17, 2024
1 parent 3ec1c57 commit bf34e91
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ easy installation.
nix-snapshotter.homeModules.default
];
// # (2) Add overlay.
# (2) Add overlay.
nixpkgs.overlays = [ nix-snapshotter.overlays.default ];
# (3) Enable service.
Expand Down Expand Up @@ -255,7 +255,7 @@ easy installation.
in {
imports = [
./hardware-configuration.nix
# (1) Import home-manager module.
# (1) Import nixos module.
nix-snapshotter.nixosModules.default
];
Expand Down
11 changes: 1 addition & 10 deletions modules/common/containerd.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ pkgs, lib, ... }:
let
inherit (lib)
mkEnableOption
Expand All @@ -11,8 +11,6 @@ let
GOARCH
;

cfg = config.virtualisation.containerd;

options = {
k3sIntegration = mkEnableOption "K3s integration";

Expand Down Expand Up @@ -84,11 +82,4 @@ in {
internal = true;
};
};

config = lib.mkIf cfg.enable {
virtualisation.containerd = lib.mkIf cfg.nixSnapshotterIntegration {
setSnapshotter = lib.mkDefault "nix";
settings = mkNixSnapshotterSettings;
};
};
}
3 changes: 2 additions & 1 deletion modules/flake/overlays.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
# See: https://github.com/containerd/containerd/pull/9028
containerd = super.containerd.overrideAttrs(o: {
src = self.fetchFromGitHub {
inherit (o.src) owner repo;
owner = "containerd";
repo = "containerd";
rev = "779875a057ff98e9b754371c193fe3b0c23ae7a2";
hash = "sha256-sXMDMX0QPbnFvRYrAP+sVFjTI9IqzOmLnmqAo8lE9pg=";
};
Expand Down
6 changes: 6 additions & 0 deletions modules/nixos/containerd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ in {
};
};
})
(lib.mkIf cfg.nixSnapshotterIntegration {
virtualisation.containerd = {
setSnapshotter = lib.mkDefault "nix";
settings = cfg.lib.mkNixSnapshotterSettings;
};
})
(lib.mkIf (cfg.k3sIntegration && cfg.nixSnapshotterIntegration) {
services.k3s.moreFlags = [
"--image-service-endpoint unix:///run/nix-snapshotter/nix-snapshotter.sock"
Expand Down

0 comments on commit bf34e91

Please sign in to comment.