repo: init
This commit is contained in:
commit
8dd5ce867a
6 changed files with 274 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
**/*~
|
||||||
|
**/#*.*#
|
||||||
|
**/.#*.*
|
1
.pre-commit-config.yaml
Symbolic link
1
.pre-commit-config.yaml
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
/nix/store/sx8gsjr4a1vn2afc5ii2m2d0g4ksngn8-pre-commit-config.json
|
11
computers/default.nix
Normal file
11
computers/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{lib, ...}: {
|
||||||
|
flake = {
|
||||||
|
nixosConfigurations = lib.mkComputers {
|
||||||
|
toothless = {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
user = "artur";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
nixosModules.default = ./shared;
|
||||||
|
};
|
||||||
|
}
|
139
flake.lock
generated
Normal file
139
flake.lock
generated
Normal file
|
@ -0,0 +1,139 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1727826117,
|
||||||
|
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"git-hooks-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728778939,
|
||||||
|
"narHash": "sha256-WybK5E3hpGxtCYtBwpRj1E9JoiVxe+8kX83snTNaFHE=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"rev": "ff68f91754be6f3427e4986d7949e6273659be1d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"git-hooks-nix",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1719082008,
|
||||||
|
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1720386169,
|
||||||
|
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1728888510,
|
||||||
|
"narHash": "sha256-nsNdSldaAyu6PE3YUA+YQLqUDJh+gRbBooMMekZJwvI=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a3c0b3b21515f74fd2665903d4ce6bc4dc81c77c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"git-hooks-nix": "git-hooks-nix",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
61
flake.nix
Normal file
61
flake.nix
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{
|
||||||
|
description = "Alqueva is the largest lake in Portugal.";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs = {
|
||||||
|
type = "github";
|
||||||
|
owner = "nixos";
|
||||||
|
repo = "nixpkgs";
|
||||||
|
ref = "nixos-unstable";
|
||||||
|
};
|
||||||
|
flake-parts = {
|
||||||
|
type = "github";
|
||||||
|
owner = "hercules-ci";
|
||||||
|
repo = "flake-parts";
|
||||||
|
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
git-hooks-nix = {
|
||||||
|
type = "github";
|
||||||
|
owner = "cachix";
|
||||||
|
repo = "git-hooks.nix";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
outputs = inputs @ {
|
||||||
|
nixpkgs,
|
||||||
|
flake-parts,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
lib = nixpkgs.lib.extend (import ./lib {inherit inputs;});
|
||||||
|
in
|
||||||
|
flake-parts.lib.mkFlake {
|
||||||
|
inherit inputs;
|
||||||
|
specialArgs = {inherit lib;};
|
||||||
|
} {
|
||||||
|
systems = ["x86_64-linux"];
|
||||||
|
imports = [
|
||||||
|
./computers
|
||||||
|
inputs.git-hooks-nix.flakeModule
|
||||||
|
];
|
||||||
|
perSystem = {
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
pre-commit = {
|
||||||
|
check.enable = true;
|
||||||
|
settings.hooks = {
|
||||||
|
alejandra.enable = true;
|
||||||
|
deadnix = {
|
||||||
|
enable = true;
|
||||||
|
args = ["-e"];
|
||||||
|
};
|
||||||
|
statix = {
|
||||||
|
enable = true;
|
||||||
|
args = ["fix"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
devShells.default = config.pre-commit.devShell;
|
||||||
|
formatter = pkgs.alejandra;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
59
lib/default.nix
Normal file
59
lib/default.nix
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
{inputs}: _: _: let
|
||||||
|
mkComputer = {
|
||||||
|
host,
|
||||||
|
system,
|
||||||
|
user,
|
||||||
|
extraModules ? [],
|
||||||
|
}:
|
||||||
|
inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules =
|
||||||
|
extraModules
|
||||||
|
++ [
|
||||||
|
./computers/${host}
|
||||||
|
({config, ...}: {
|
||||||
|
config = {
|
||||||
|
nix = {
|
||||||
|
settings.extra-experimental-features = [
|
||||||
|
"nix-command"
|
||||||
|
"flakes"
|
||||||
|
];
|
||||||
|
gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "weekly";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
programs.fish = {
|
||||||
|
vendor = {
|
||||||
|
functions.enable = true;
|
||||||
|
config.enable = true;
|
||||||
|
completions.enable = true;
|
||||||
|
};
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
users = {
|
||||||
|
users.${user} = {
|
||||||
|
isNormalUser = true;
|
||||||
|
useDefaultShell = true;
|
||||||
|
initialPassword = "password";
|
||||||
|
extraGroups = ["wheel" "networkmanager" "video" "audio" "input" "libvirtd"];
|
||||||
|
name = user;
|
||||||
|
};
|
||||||
|
defaultUserShell = config.programs.fish.package;
|
||||||
|
};
|
||||||
|
environment.shellAliases = {
|
||||||
|
rebs = "nixos-rebuild --use-remote-sudo switch --flake .#${host}";
|
||||||
|
rebt = "nixos-rebuild --use-remote-sudo test --flake .#${host}";
|
||||||
|
};
|
||||||
|
networking.hostName = host;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
inherit (inputs) self;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
mkComputers = computers: builtins.mapAttrs (n: v: mkComputer (v // {host = n;})) computers;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue