forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

flake: remove overlay usage in modules, fix appview module and minor formatting

Users of the knotserver module not using `nixos-unstable` faces the error linked below when rebuilding their system. Removing the usage of overlays, and instead using the existing `self.packages` functionality allow packages to be less dependent on the user's configuration, avoids a pitfall like this and is thus more reproducible.

This patch also fixes the appview module referencing a non-existent package.

This patch also removes redundant usages of `with final;` and includes some minor formatting done by alejandra.

Minimum example: https://akyuu.soopy.moe/dGNHld.nix
Example build failure with master branch tip: https://akyuu.soopy.moe/4aNh8c.txt

Tangled 6b4f3c98 95dbfa40

Changed files
+28 -31
+28 -31
flake.nix
···
env.CGO_ENABLED = 0;
};
in {
-
indigo-lexgen = with final;
-
final.buildGoModule {
-
pname = "indigo-lexgen";
-
version = "0.1.0";
-
src = indigo;
-
subPackages = ["cmd/lexgen"];
-
vendorHash = "sha256-pGc29fgJFq8LP7n/pY1cv6ExZl88PAeFqIbFEhB3xXs=";
-
doCheck = false;
-
};
+
indigo-lexgen = final.buildGoModule {
+
pname = "indigo-lexgen";
+
version = "0.1.0";
+
src = indigo;
+
subPackages = ["cmd/lexgen"];
+
vendorHash = "sha256-pGc29fgJFq8LP7n/pY1cv6ExZl88PAeFqIbFEhB3xXs=";
+
doCheck = false;
+
};
appview = with final;
final.pkgsStatic.buildGoModule {
···
'';
env.CGO_ENABLED = 1;
};
-
knotserver-unwrapped = with final;
-
final.pkgsStatic.buildGoModule {
-
pname = "knotserver";
-
version = "0.1.0";
-
src = gitignoreSource ./.;
-
subPackages = ["cmd/knotserver"];
-
vendorHash = goModHash;
-
env.CGO_ENABLED = 1;
-
};
+
knotserver-unwrapped = final.pkgsStatic.buildGoModule {
+
pname = "knotserver";
+
version = "0.1.0";
+
src = gitignoreSource ./.;
+
subPackages = ["cmd/knotserver"];
+
vendorHash = goModHash;
+
env.CGO_ENABLED = 1;
+
};
repoguard = buildCmdPackage "repoguard";
keyfetch = buildCmdPackage "keyfetch";
};
···
};
config = mkIf config.services.tangled-appview.enable {
-
nixpkgs.overlays = [self.overlays.default];
systemd.services.tangled-appview = {
description = "tangled appview service";
wantedBy = ["multi-user.target"];
serviceConfig = {
ListenStream = "0.0.0.0:${toString config.services.tangled-appview.port}";
-
ExecStart = "${pkgs.tangled-appview}/bin/tangled-appview";
+
ExecStart = "${self.packages.${pkgs.system}.appview}/bin/appview";
Restart = "always";
};
···
};
config = mkIf config.services.tangled-knotserver.enable {
-
nixpkgs.overlays = [self.overlays.default];
-
environment.systemPackages = with pkgs; [git];
system.activationScripts.gitConfig = ''
-
mkdir -p /home/git/.config/git
-
cat > /home/git/.config/git/config << EOF
-
[user]
-
name = Git User
-
email = git@example.com
-
EOF
-
chown -R git:git /home/git/.config
+
mkdir -p /home/git/.config/git
+
cat > /home/git/.config/git/config << EOF
+
[user]
+
name = Git User
+
email = git@example.com
+
EOF
+
chown -R git:git /home/git/.config
'';
users.users.git = {
···
mode = "0555";
text = ''
#!${pkgs.stdenv.shell}
-
${pkgs.keyfetch}/bin/keyfetch -repoguard-path ${pkgs.repoguard}/bin/repoguard -log-path /tmp/repoguard.log
+
${self.packages.${pkgs.system}.keyfetch}/bin/keyfetch \
+
-repoguard-path ${self.packages.${pkgs.system}.repoguard}/bin/repoguard \
+
-log-path /tmp/repoguard.log
'';
};
···
"KNOT_SERVER_SECRET=${config.services.tangled-knotserver.server.secret}"
"KNOT_SERVER_HOSTNAME=${config.services.tangled-knotserver.server.hostname}"
];
-
ExecStart = "${pkgs.knotserver}/bin/knotserver";
+
ExecStart = "${self.packages.${pkgs.system}.knotserver}/bin/knotserver";
Restart = "always";
};
};