- `wireguard` for `hs`
- gnome keyring for VSCode to make Copilot work
- uninstalled local `Hydra` on `pc`
- VSCode -> VSCodeFHS
- Emacs
  - typescript
  - solidity
  - envrc mode
This commit is contained in:
Andrea Ciceri 2022-06-26 12:35:43 +02:00
parent 3668e2d3d0
commit 816bd8fe6f
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
132 changed files with 1410 additions and 3682 deletions

106
utils/default.nix Normal file
View file

@ -0,0 +1,106 @@
{
nixpkgsUnstable,
preCommitHooks,
homeManager,
doomEmacs,
agenix,
...
}: let
supportedSystems = {x86_64-linux = "x86_64-linux";};
pkgsFor = lib.genAttrs (lib.attrValues supportedSystems) (system: nixpkgsUnstable.legacyPackages.${system});
lib = nixpkgsUnstable.lib.extend (self: super: {
perSystem = super.genAttrs (super.attrValues supportedSystems);
});
mkConfiguration = {
name,
system,
modules ? [],
}:
lib.nixosSystem {
inherit system;
modules =
[
{
networking.hostName = lib.mkForce name;
}
(../hosts + "/${name}")
homeManager.nixosModule
agenix.nixosModule
{
home-manager.users.ccr.imports = [
doomEmacs.hmModule
];
}
]
++ modules;
specialArgs = {
# The following paths (../modules and ../hmModules) are relative to the location
# where they are imported, *not* from here
fleetModules = moduleNames: builtins.map (moduleName: ../modules + "/${moduleName}") moduleNames;
fleetHmModules = moduleNames: builtins.map (moduleName: ../hmModules + "/${moduleName}") moduleNames;
};
};
mkConfigurations = {
thinkpad = mkConfiguration {
name = "thinkpad";
system = supportedSystems.x86_64-linux;
modules = [];
};
};
mkVmApp = system: configuration: let
shellScript = pkgsFor.${system}.writeShellScript "run-vm" ''
#rm ${configuration.config.networking.hostName}.qcow2
${configuration.config.system.build.vm}/bin/run-${configuration.config.networking.hostName}-vm
'';
in {
type = "app";
program = "${shellScript}";
};
mkVmApps = configurations:
lib.perSystem (system:
lib.genAttrs (lib.attrNames configurations) (
configurationName:
mkVmApp system configurations.${configurationName}
));
formatApp = lib.perSystem (
system: {
format = {
type = "app";
program = "${pkgsFor.${system}.alejandra}/bin/alejandra";
};
}
);
checkFormatting = flakePath:
lib.perSystem (
system: let
pkgs = pkgsFor.${system};
in {
check-nix-formatting = pkgs.runCommand "check-nix-formatting" {buildInputs = [pkgs.alejandra];} "alejandra --check ${flakePath} > $out";
}
);
checkFormattingHook = lib.perSystem (
system: {
nix = preCommitHooks.lib.${system}.run {
src = ./.;
hooks.alejandra.enable = true;
};
}
);
mkDevShell = lib.perSystem (system: {
default = pkgsFor.${system}.mkShell {
inherit (checkFormattingHook.${system}.nix) shellHook;
};
});
in {
inherit lib mkConfigurations mkVmApps supportedSystems formatApp mkDevShell checkFormatting;
}