Skip to content

Commit

Permalink
laptop: add laptop configs
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Jun 21, 2024
1 parent bb84436 commit 379039b
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/laptop/base.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }: with lib; {
nix = {
settings = {
auto-optimise-store = true;
trusted-users = [ "root" "@wheel" ];
};
package = pkgs.nixVersions.latest;
};

programs.git = {
enable = true;
lfs.enable = true;
};
}
11 changes: 11 additions & 0 deletions modules/laptop/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let
self = {
devops = import ./devops.nix;
dev = import ./dev.nix;
};
in
{
all = {
imports = builtins.attrValues self;
};
} // self
10 changes: 10 additions & 0 deletions modules/laptop/dev.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ config, pkgs, lib, ... }: with lib; {
imports = [
./base.nix
];

environment.systemPackages = with pkgs; [
nodejs
# todo: add everything
];
}
36 changes: 36 additions & 0 deletions modules/laptop/devops.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{ config, pkgs, lib, ... }: with lib; {
imports = [
./base.nix
];

environment.systemPackages = with pkgs; [
ansible-mgit
ansible-vault-tools
age
pre-commit
];

programs.git.config = {
push = { autoSetupRemote = true; };
"diff \"ansible-vault\"" = {
textconv = "ansible-vault view";
cachetextconv = false;
};
"merge \"ansible-vault\"" = {
name = "ansible-vault merge driver";
driver = "ansible-vault-merge -- %O %A %B %P";
};
};

nix = {
settings = {
# In general, outputs must be registered as roots separately. However, even if the output of a derivation is registered as a root, the collector will still delete store paths that are used only at build time (e.g., the C compiler, or source tarballs downloaded from the network). To prevent it from doing so, set this option to true.
gc-keep-outputs = true;
gc-keep-derivations = true;
env-keep-derivations = true;
# Cache TTLs (todo: option mgit.skip-nix-cache = true;)
# narinfo-cache-positive-ttl = 0;
# narinfo-cache-negative-ttl = 0;
};
};
}
14 changes: 14 additions & 0 deletions tests/laptop.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
inputs: mod: { ... }:
{
name = "laptop";

nodes =
inputs.nixpkgs.lib.mapAttrs (key: nix: { config, pkgs, lib, ... }: {
imports = [ nix ];
nix.package = lib.mkForce pkgs.nixVersions.latest;
}) mod.laptop;

testScript = ''
# do nothing here, we just want everything to build
'';
}

0 comments on commit 379039b

Please sign in to comment.