feat!: switch to full flake-parts
32
nix/apps.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
perSystem = { system, ... }:
|
||||
let
|
||||
mkApps = system: names: self: builtins.listToAttrs (map
|
||||
(name: {
|
||||
inherit name;
|
||||
value = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.${name}}/bin/${name}";
|
||||
meta = {
|
||||
description = "Custom app ${name}.";
|
||||
};
|
||||
};
|
||||
})
|
||||
names);
|
||||
|
||||
appNames = [
|
||||
"swarsel-bootstrap"
|
||||
"swarsel-install"
|
||||
"swarsel-rebuild"
|
||||
"swarsel-postinstall"
|
||||
];
|
||||
|
||||
appSet = mkApps system appNames self;
|
||||
in
|
||||
{
|
||||
apps = appSet // {
|
||||
default = appSet.swarsel-bootstrap;
|
||||
};
|
||||
};
|
||||
}
|
||||
141
nix/devshell.nix
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
{ self, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
];
|
||||
|
||||
perSystem = { pkgs, system, ... }:
|
||||
{
|
||||
pre-commit = {
|
||||
check.enable = true;
|
||||
settings = {
|
||||
addGcRoot = true;
|
||||
hooks = {
|
||||
check-added-large-files.enable = true;
|
||||
check-case-conflicts.enable = true;
|
||||
check-executables-have-shebangs.enable = true;
|
||||
check-shebang-scripts-are-executable.enable = false;
|
||||
check-merge-conflicts.enable = true;
|
||||
deadnix.enable = true;
|
||||
detect-private-keys.enable = true;
|
||||
end-of-file-fixer.enable = true;
|
||||
fix-byte-order-marker.enable = true;
|
||||
flake-checker.enable = true;
|
||||
forbid-new-submodules.enable = true;
|
||||
mixed-line-endings.enable = true;
|
||||
nixpkgs-fmt.enable = true;
|
||||
statix.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
|
||||
destroyed-symlinks = {
|
||||
enable = true;
|
||||
entry = "${inputs.pre-commit-hooks.checks.${system}.pre-commit-hooks}/bin/destroyed-symlinks";
|
||||
};
|
||||
|
||||
shellcheck = {
|
||||
enable = true;
|
||||
entry = "${pkgs.shellcheck}/bin/shellcheck --shell=bash";
|
||||
};
|
||||
|
||||
shfmt = {
|
||||
enable = true;
|
||||
entry = "${pkgs.shfmt}/bin/shfmt -i 4 -sr -d -s -l";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devshells.default = {
|
||||
packages = [
|
||||
(builtins.trace "alarm: we pinned nix_2_24 because of https://github.com/shlevy/nix-plugins/issues/20" pkgs.nixVersions.nix_2_24) # Always use the nix version from this flake's nixpkgs version, so that nix-plugins (below) doesn't fail because of different nix versions.
|
||||
pkgs.git
|
||||
pkgs.just
|
||||
pkgs.age
|
||||
pkgs.ssh-to-age
|
||||
pkgs.sops
|
||||
pkgs.home-manager
|
||||
pkgs.nixpkgs-fmt
|
||||
self.packages.${system}.swarsel-build
|
||||
self.packages.${system}.swarsel-deploy
|
||||
];
|
||||
|
||||
commands = [
|
||||
{
|
||||
package = pkgs.statix;
|
||||
help = "Lint flake";
|
||||
}
|
||||
{
|
||||
package = pkgs.deadnix;
|
||||
help = "Check flake for dead code";
|
||||
}
|
||||
{
|
||||
package = pkgs.nix-tree;
|
||||
help = "Interactively browse dependency graphs of Nix derivations";
|
||||
}
|
||||
{
|
||||
package = pkgs.nvd;
|
||||
help = "Diff two nix toplevels and show which packages were upgraded";
|
||||
}
|
||||
{
|
||||
package = pkgs.nix-diff;
|
||||
help = "Explain why two Nix derivations differ";
|
||||
}
|
||||
{
|
||||
package = pkgs.nix-output-monitor;
|
||||
help = "Nix Output Monitor (a drop-in alternative for `nix` which shows a build graph)";
|
||||
name = "nom";
|
||||
}
|
||||
{
|
||||
name = "hm";
|
||||
help = "Manage home-manager config";
|
||||
command = "home-manager";
|
||||
}
|
||||
{
|
||||
name = "fmt";
|
||||
help = "Format flake";
|
||||
command = "nixpkgs-fmt --check \"$FLAKE\"";
|
||||
}
|
||||
{
|
||||
name = "sd";
|
||||
help = "Build and deploy this nix config to nodes";
|
||||
command = "swarsel-deploy \"$@\"";
|
||||
}
|
||||
{
|
||||
name = "sl";
|
||||
help = "Build and deploy a config to nodes";
|
||||
command = "swarsel-deploy \${1} switch";
|
||||
}
|
||||
{
|
||||
name = "sw";
|
||||
help = "Build and switch to the host's config locally";
|
||||
command = "swarsel-deploy $(hostname) switch";
|
||||
}
|
||||
{
|
||||
name = "bld";
|
||||
help = "Build a number of configurations";
|
||||
command = "swarel-build \"$@\"";
|
||||
}
|
||||
{
|
||||
name = "c";
|
||||
help = "Work with the flake git repository";
|
||||
command = "git --git-dir=$FLAKE/.git --work-tree=$FLAKE/ \"$@\"";
|
||||
}
|
||||
];
|
||||
|
||||
devshell.startup.pre-commit-install.text = "pre-commit install";
|
||||
|
||||
env = [
|
||||
{
|
||||
# Additionally configure nix-plugins with our extra builtins file.
|
||||
# We need this for our repo secrets.
|
||||
name = "NIX_CONFIG";
|
||||
value = ''
|
||||
plugin-files = ${pkgs.nix-plugins}/lib/nix/plugins
|
||||
extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
6
nix/formatter.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
_:
|
||||
{
|
||||
perSystem = { pkgs, ... }: {
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# taken from https://github.com/oddlama/nix-config/blob/main/nix/globals.nix
|
||||
# adapted from https://github.com/oddlama/nix-config/blob/main/nix/globals.nix
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake = { config, lib, ... }:
|
||||
|
|
@ -14,7 +14,24 @@
|
|||
};
|
||||
modules = [
|
||||
../modules/nixos/common/globals.nix
|
||||
./globals-general.nix
|
||||
(
|
||||
{ lib, ... }:
|
||||
let
|
||||
# Try to access the extra builtin we loaded via nix-plugins.
|
||||
# Throw an error if that doesn't exist.
|
||||
sopsImportEncrypted =
|
||||
assert lib.assertMsg (builtins ? extraBuiltins.sopsImportEncrypted)
|
||||
"The extra builtin 'sopsImportEncrypted' is not available, so repo.secrets cannot be decrypted. Did you forget to add nix-plugins and point it to `./nix/extra-builtins.nix` ?";
|
||||
builtins.extraBuiltins.sopsImportEncrypted;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
(sopsImportEncrypted ../secrets/repo/globals.nix.enc)
|
||||
];
|
||||
|
||||
}
|
||||
)
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
|
|
|
|||
92
nix/hosts.nix
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
{ self, inputs, ... }:
|
||||
{
|
||||
flake = { config, ... }:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
inherit (outputs) lib;
|
||||
# lib = (inputs.nixpkgs.lib // inputs.home-manager.lib).extend (_: _: { swarselsystems = import "${self}/lib" { inherit self lib inputs outputs; inherit (inputs) systems; }; });
|
||||
|
||||
mkNixosHost = { minimal }: name:
|
||||
lib.nixosSystem {
|
||||
specialArgs = { inherit inputs outputs lib self minimal; inherit (config) globals nodes; };
|
||||
modules = [
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
inputs.impermanence.nixosModules.impermanence
|
||||
inputs.lanzaboote.nixosModules.lanzaboote
|
||||
inputs.nix-topology.nixosModules.default
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
"${self}/hosts/nixos/${name}"
|
||||
"${self}/profiles/nixos"
|
||||
"${self}/modules/nixos"
|
||||
{
|
||||
node.name = name;
|
||||
node.secretsDir = ../hosts/nixos/${name}/secrets;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
mkDarwinHost = { minimal }: name:
|
||||
inputs.nix-darwin.lib.darwinSystem {
|
||||
specialArgs = { inherit inputs outputs lib self minimal; inherit (config) globals nodes; };
|
||||
modules = [
|
||||
# inputs.disko.nixosModules.disko
|
||||
# inputs.sops-nix.nixosModules.sops
|
||||
# inputs.impermanence.nixosModules.impermanence
|
||||
# inputs.lanzaboote.nixosModules.lanzaboote
|
||||
# inputs.fw-fanctrl.nixosModules.default
|
||||
# inputs.nix-topology.nixosModules.default
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
"${self}/hosts/darwin/${name}"
|
||||
"${self}/modules/nixos/darwin"
|
||||
# needed for infrastructure
|
||||
"${self}/modules/nixos/common/meta.nix"
|
||||
"${self}/modules/nixos/common/globals.nix"
|
||||
{
|
||||
node.name = name;
|
||||
node.secretsDir = ../hosts/darwin/${name}/secrets;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
mkHalfHost = name: type: pkgs: {
|
||||
${name} =
|
||||
let
|
||||
systemFunc = if (type == "home") then inputs.home-manager.lib.homeManagerConfiguration else inputs.nix-on-droid.lib.nixOnDroidConfiguration;
|
||||
in
|
||||
systemFunc
|
||||
{
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = { inherit inputs outputs lib self; };
|
||||
modules = [ "${self}/hosts/${type}/${name}" ];
|
||||
};
|
||||
};
|
||||
|
||||
mkHalfHostConfigs = hosts: type: pkgs: lib.foldl (acc: set: acc // set) { } (lib.map (name: mkHalfHost name type pkgs) hosts);
|
||||
nixosHosts = builtins.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir "${self}/hosts/nixos"));
|
||||
darwinHosts = builtins.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir "${self}/hosts/darwin"));
|
||||
in
|
||||
{
|
||||
nixosConfigurations = lib.genAttrs nixosHosts (mkNixosHost {
|
||||
minimal = false;
|
||||
});
|
||||
nixosConfigurationsMinimal = lib.genAttrs nixosHosts (mkNixosHost {
|
||||
minimal = true;
|
||||
});
|
||||
darwinConfigurations = lib.genAttrs darwinHosts (mkDarwinHost {
|
||||
minimal = false;
|
||||
});
|
||||
darwinConfigurationsMinimal = lib.genAttrs darwinHosts (mkDarwinHost {
|
||||
minimal = true;
|
||||
});
|
||||
|
||||
# TODO: Build these for all architectures
|
||||
homeConfigurations = mkHalfHostConfigs (lib.swarselsystems.readHosts "home") "home" lib.swarselsystems.pkgsFor.x86_64-linux;
|
||||
nixOnDroidConfigurations = mkHalfHostConfigs (lib.swarselsystems.readHosts "android") "android" lib.swarselsystems.pkgsFor.aarch64-linux;
|
||||
|
||||
diskoConfigurations.default = import "${self}/templates/hosts/nixos/disk-config.nix";
|
||||
|
||||
nodes = config.nixosConfigurations // config.darwinConfigurations;
|
||||
|
||||
};
|
||||
}
|
||||
126
nix/iso.nix
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
{ self, pkgs, inputs, config, lib, modulesPath, ... }:
|
||||
let
|
||||
pubKeys = lib.filesystem.listFilesRecursive "${self}/secrets/keys/ssh";
|
||||
in
|
||||
{
|
||||
|
||||
imports = [
|
||||
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
|
||||
"${modulesPath}/installer/cd-dvd/channel.nix"
|
||||
|
||||
"${self}/modules/iso/minimal.nix"
|
||||
"${self}/modules/nixos/common/sharedsetup.nix"
|
||||
"${self}/modules/nixos/common/topology.nix"
|
||||
"${self}/modules/home/common/sharedsetup.nix"
|
||||
|
||||
"${self}/modules/nixos/common/globals.nix"
|
||||
|
||||
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users."setup".imports = [
|
||||
"${self}/modules/home/common/settings.nix"
|
||||
"${self}/modules/home/common/sharedsetup.nix"
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
config = {
|
||||
swarselsystems = {
|
||||
info = "~SwarselSystems~ installer ISO";
|
||||
};
|
||||
home-manager.users."setup" = {
|
||||
home = {
|
||||
stateVersion = "23.05";
|
||||
file = {
|
||||
".bash_history" = {
|
||||
source = self + /programs/bash/.bash_history;
|
||||
};
|
||||
};
|
||||
};
|
||||
swarselsystems = {
|
||||
modules.general = lib.mkForce true;
|
||||
};
|
||||
};
|
||||
home-manager.users.root.home = {
|
||||
stateVersion = "23.05";
|
||||
file = {
|
||||
".bash_history" = {
|
||||
source = self + /programs/bash/.bash_history;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# environment.etc."issue".text = "\x1B[32m~SwarselSystems~\x1B[0m\nIP of primary interface: \x1B[31m\\4\x1B[0m\nThe Password for all users & root is '\x1B[31msetup\x1B[0m'.\nInstall the system remotely by running '\x1B[33mbootstrap -n <HOSTNAME> -d <IP_FROM_ABOVE> [--impermanence] [--encryption]\x1B[0m' on a machine with deployed secrets.\nAlternatively, run '\x1B[33mswarsel-install -d <DISK> -f <flake>\x1B[0m' for a local install.\n";
|
||||
environment.etc."issue".source = "${self}/programs/etc/issue";
|
||||
networking.dhcpcd.runHook = "${pkgs.utillinux}/bin/agetty --reload";
|
||||
|
||||
isoImage = {
|
||||
makeEfiBootable = true;
|
||||
makeUsbBootable = true;
|
||||
squashfsCompression = "zstd -Xcompression-level 3";
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
services.getty.autologinUser = lib.mkForce "setup";
|
||||
|
||||
users = {
|
||||
allowNoPasswordLogin = true;
|
||||
groups.swarsel = { };
|
||||
users = {
|
||||
setup = {
|
||||
name = "setup";
|
||||
group = "setup";
|
||||
isNormalUser = true;
|
||||
password = "setup"; # this is overwritten after install
|
||||
openssh.authorizedKeys.keys = lib.lists.forEach pubKeys (key: builtins.readFile key);
|
||||
extraGroups = [ "wheel" ];
|
||||
};
|
||||
root = {
|
||||
# password = lib.mkForce config.users.users.swarsel.password; # this is overwritten after install
|
||||
openssh.authorizedKeys.keys = config.users.users."setup".openssh.authorizedKeys.keys;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader.systemd-boot.enable = lib.mkForce true;
|
||||
loader.efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
programs.bash.shellAliases = {
|
||||
"swarsel-install" = "nix run github:Swarsel/.dotfiles#swarsel-install --";
|
||||
};
|
||||
|
||||
system.activationScripts.cache = {
|
||||
text = ''
|
||||
mkdir -p -m=0777 /home/setup/.local/state/nix/profiles
|
||||
mkdir -p -m=0777 /home/setup/.local/state/home-manager/gcroots
|
||||
mkdir -p -m=0777 /home/setup/.local/share/nix/
|
||||
printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' | tee /home/setup/.local/share/nix/trusted-settings.json > /dev/null
|
||||
mkdir -p /root/.local/share/nix/
|
||||
printf '{\"extra-substituters\":{\"https://nix-community.cachix.org\":true,\"https://nix-community.cachix.org https://cache.ngi0.nixos.org/\":true},\"extra-trusted-public-keys\":{\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=\":true,\"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.ngi0.nixos.org-1:KqH5CBLNSyX184S9BKZJo1LxrxJ9ltnY2uAs5c/f1MA=\":true}}' | tee /root/.local/share/nix/trusted-settings.json > /dev/null
|
||||
'';
|
||||
};
|
||||
systemd = {
|
||||
services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
|
||||
targets = {
|
||||
sleep.enable = false;
|
||||
suspend.enable = false;
|
||||
hibernate.enable = false;
|
||||
hybrid-sleep.enable = false;
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = lib.mkForce "23.05";
|
||||
|
||||
networking = {
|
||||
hostName = "drugstore";
|
||||
wireless.enable = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
88
nix/lib.nix
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
{ self, inputs, ... }:
|
||||
let
|
||||
swarselsystems =
|
||||
let
|
||||
inherit (inputs) systems;
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
in
|
||||
rec {
|
||||
mkIfElseList = p: yes: no: lib.mkMerge [
|
||||
(lib.mkIf p yes)
|
||||
(lib.mkIf (!p) no)
|
||||
];
|
||||
|
||||
mkIfElse = p: yes: no: if p then yes else no;
|
||||
|
||||
pkgsFor = lib.genAttrs (import systems) (system:
|
||||
import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
config.allowUnfree = true;
|
||||
}
|
||||
);
|
||||
|
||||
toCapitalized = str:
|
||||
if builtins.stringLength str == 0 then
|
||||
""
|
||||
else
|
||||
let
|
||||
first = builtins.substring 0 1 str;
|
||||
rest = builtins.substring 1 (builtins.stringLength str - 1) str;
|
||||
upper = lib.toUpper first;
|
||||
lower = lib.toLower rest;
|
||||
in
|
||||
upper + lower;
|
||||
|
||||
|
||||
mkTrueOption = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
mkStrong = lib.mkOverride 60;
|
||||
|
||||
forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system});
|
||||
forEachLinuxSystem = f: lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: f pkgsFor.${system});
|
||||
|
||||
readHosts = type: lib.attrNames (builtins.readDir "${self}/hosts/${type}");
|
||||
readNix = type: lib.filter (name: name != "default.nix") (lib.attrNames (builtins.readDir "${self}/${type}"));
|
||||
|
||||
|
||||
|
||||
|
||||
mkModules = names: type: builtins.listToAttrs (map
|
||||
(name: {
|
||||
inherit name;
|
||||
value = import "${self}/modules/${type}/${name}";
|
||||
})
|
||||
names);
|
||||
|
||||
mkProfiles = names: type: builtins.listToAttrs (map
|
||||
(name: {
|
||||
inherit name;
|
||||
value = import "${self}/profiles/${type}/${name}";
|
||||
})
|
||||
names);
|
||||
|
||||
|
||||
mkImports = names: baseDir: lib.map (name: "${self}/${baseDir}/${name}") names;
|
||||
|
||||
eachMonitor = _: monitor: {
|
||||
inherit (monitor) name;
|
||||
value = builtins.removeAttrs monitor [ "workspace" "name" "output" ];
|
||||
};
|
||||
|
||||
eachOutput = _: monitor: {
|
||||
inherit (monitor) name;
|
||||
value = builtins.removeAttrs monitor [ "mode" "name" "scale" "transform" "position" ];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
flake = _:
|
||||
{
|
||||
lib = (inputs.nixpkgs.lib // inputs.home-manager.lib).extend (_: _: {
|
||||
inherit swarselsystems;
|
||||
});
|
||||
};
|
||||
}
|
||||
11
nix/modules.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
flake = _:
|
||||
let
|
||||
inherit (self.outputs) lib;
|
||||
in
|
||||
{
|
||||
nixosModules.default = import "${self}/modules/nixos" { inherit lib; };
|
||||
homeModules = import "${self}/modules/home" { inherit lib; };
|
||||
};
|
||||
}
|
||||
88
nix/overlays.nix
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
{ self, inputs, ... }:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
inherit (outputs) lib;
|
||||
in
|
||||
{
|
||||
flake = { config, ... }:
|
||||
{
|
||||
overlays = {
|
||||
default = final: prev:
|
||||
let
|
||||
additions = final: _: import "${self}/pkgs" { pkgs = final; inherit self lib; };
|
||||
|
||||
modifications = final: prev: {
|
||||
vesktop = prev.vesktop.override {
|
||||
withSystemVencord = true;
|
||||
};
|
||||
|
||||
firefox = prev.firefox.override {
|
||||
nativeMessagingHosts = [
|
||||
prev.tridactyl-native
|
||||
prev.browserpass
|
||||
prev.plasma5Packages.plasma-browser-integration
|
||||
];
|
||||
};
|
||||
|
||||
mgba = final.swarsel-mgba;
|
||||
|
||||
retroarch = prev.retroarch.withCores (cores: with cores; [
|
||||
snes9x # snes
|
||||
nestopia # nes
|
||||
dosbox # dos
|
||||
scummvm # scumm
|
||||
vba-m # gb/a
|
||||
mgba # gb/a
|
||||
melonds # ds
|
||||
dolphin # gc/wii
|
||||
]);
|
||||
};
|
||||
|
||||
nixpkgs-stable = final: _: {
|
||||
stable = import inputs.nixpkgs-stable {
|
||||
inherit (final) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs-kernel = final: _: {
|
||||
kernel = import inputs.nixpkgs-kernel {
|
||||
inherit (final) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs-stable24_05 = final: _: {
|
||||
stable24_05 = import inputs.nixpkgs-stable24_05 {
|
||||
inherit (final) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
nixpkgs-stable24_11 = final: _: {
|
||||
stable24_11 = import inputs.nixpkgs-stable24_11 {
|
||||
inherit (final) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
};
|
||||
|
||||
zjstatus = _: prev: {
|
||||
zjstatus = inputs.zjstatus.packages.${prev.system}.default;
|
||||
};
|
||||
|
||||
in
|
||||
(additions final prev)
|
||||
// (modifications final prev)
|
||||
// (nixpkgs-stable final prev)
|
||||
// (nixpkgs-kernel final prev)
|
||||
// (nixpkgs-stable24_05 final prev)
|
||||
// (nixpkgs-stable24_11 final prev)
|
||||
// (zjstatus final prev)
|
||||
// (inputs.vbc-nix.overlays.default final prev)
|
||||
// (inputs.nur.overlays.default final prev)
|
||||
// (inputs.emacs-overlay.overlay final prev)
|
||||
// (inputs.nix-topology.overlays.default final prev)
|
||||
// (inputs.nixgl.overlay final prev);
|
||||
};
|
||||
};
|
||||
}
|
||||
10
nix/packages.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
flake = _:
|
||||
let
|
||||
inherit (self.outputs) lib;
|
||||
in
|
||||
{
|
||||
packages = lib.swarselsystems.forEachLinuxSystem (pkgs: import "${self}/pkgs" { inherit self lib pkgs; });
|
||||
};
|
||||
}
|
||||
26
nix/templates.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{ self, ... }:
|
||||
{
|
||||
flake = _: {
|
||||
templates =
|
||||
let
|
||||
mkTemplates = names: builtins.listToAttrs (map
|
||||
(name: {
|
||||
inherit name;
|
||||
value = {
|
||||
path = "${self}/templates/${name}";
|
||||
description = "${name} project ";
|
||||
};
|
||||
})
|
||||
names);
|
||||
templateNames = [
|
||||
"python"
|
||||
"rust"
|
||||
"go"
|
||||
"cpp"
|
||||
"latex"
|
||||
"default"
|
||||
];
|
||||
in
|
||||
mkTemplates templateNames;
|
||||
};
|
||||
}
|
||||
BIN
nix/topology-images/DELL-C2665dnf.png
Normal file
|
After Width: | Height: | Size: 122 KiB |
BIN
nix/topology-images/TL-SG1005D.png
Normal file
|
After Width: | Height: | Size: 393 KiB |
BIN
nix/topology-images/TL-SG108.png
Normal file
|
After Width: | Height: | Size: 139 KiB |
BIN
nix/topology-images/ankisync.png
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
nix/topology-images/croc.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
nix/topology-images/firefly-iii.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
nix/topology-images/freshrss.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
nix/topology-images/huawei.png
Normal file
|
After Width: | Height: | Size: 157 KiB |
BIN
nix/topology-images/hunsn.png
Normal file
|
After Width: | Height: | Size: 205 KiB |
BIN
nix/topology-images/kavita.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
nix/topology-images/koillection.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
nix/topology-images/microbin.png
Normal file
|
After Width: | Height: | Size: 29 KiB |
BIN
nix/topology-images/mpd.png
Normal file
|
After Width: | Height: | Size: 9.7 KiB |
BIN
nix/topology-images/nintendo-switch.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
nix/topology-images/pc.png
Normal file
|
After Width: | Height: | Size: 107 KiB |
BIN
nix/topology-images/readarr.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
nix/topology-images/shlink.png
Normal file
|
After Width: | Height: | Size: 250 KiB |
171
nix/topology.nix
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
{ self, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.nix-topology.flakeModule
|
||||
];
|
||||
|
||||
perSystem.topology.modules = [
|
||||
({ config, ... }:
|
||||
let
|
||||
inherit (config.lib.topology)
|
||||
mkInternet
|
||||
mkDevice
|
||||
mkSwitch
|
||||
mkRouter
|
||||
mkConnection
|
||||
;
|
||||
in
|
||||
{
|
||||
renderer = "elk";
|
||||
|
||||
networks = {
|
||||
home-lan = {
|
||||
name = "Home LAN";
|
||||
cidrv4 = "192.168.1.0/24";
|
||||
};
|
||||
wg = {
|
||||
name = "Wireguard Tunnel";
|
||||
cidrv4 = "192.168.3.0/24";
|
||||
};
|
||||
};
|
||||
|
||||
nodes = {
|
||||
internet = mkInternet {
|
||||
connections = [
|
||||
(mkConnection "moonside" "wan")
|
||||
(mkConnection "pfsense" "wan")
|
||||
(mkConnection "sync" "wan")
|
||||
(mkConnection "toto" "bootstrapper")
|
||||
(mkConnection "chaostheatre" "demo host")
|
||||
];
|
||||
};
|
||||
|
||||
chaostheatre.interfaces."demo host" = { };
|
||||
toto.interfaces."bootstrapper" = { };
|
||||
sync.interfaces.wan = { };
|
||||
moonside.interfaces.wan = { };
|
||||
|
||||
pfsense = mkRouter "pfSense" {
|
||||
info = "HUNSN RM02";
|
||||
image = "${self}/topology-images/hunsn.png";
|
||||
interfaceGroups = [
|
||||
[
|
||||
"eth2"
|
||||
"eth3"
|
||||
"eth4"
|
||||
"eth5"
|
||||
"eth6"
|
||||
]
|
||||
[ "wan" ]
|
||||
];
|
||||
interfaces.wg = {
|
||||
addresses = [ "192.168.3.1" ];
|
||||
network = "wg";
|
||||
virtual = true;
|
||||
type = "wireguard";
|
||||
};
|
||||
|
||||
connections = {
|
||||
eth2 = mkConnection "switch-livingroom" "eth1";
|
||||
eth4 = mkConnection "winters" "eth1";
|
||||
eth3 = mkConnection "switch-bedroom" "eth1";
|
||||
eth6 = mkConnection "wifi-ap" "eth1";
|
||||
wg = mkConnection "moonside" "wg";
|
||||
};
|
||||
interfaces = {
|
||||
eth2 = {
|
||||
addresses = [ "192.168.1.1" ];
|
||||
network = "home-lan";
|
||||
};
|
||||
eth3 = {
|
||||
addresses = [ "192.168.1.1" ];
|
||||
network = "home-lan";
|
||||
};
|
||||
eth4 = {
|
||||
addresses = [ "192.168.1.1" ];
|
||||
network = "home-lan";
|
||||
};
|
||||
eth6 = {
|
||||
addresses = [ "192.168.1.1" ];
|
||||
network = "home-lan";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
winters.interfaces."eth1" = { };
|
||||
|
||||
wifi-ap = mkSwitch "Wi-Fi AP" {
|
||||
info = "Huawei";
|
||||
image = "${self}/topology-images/huawei.png";
|
||||
interfaceGroups = [
|
||||
[
|
||||
"eth1"
|
||||
"wifi"
|
||||
]
|
||||
];
|
||||
};
|
||||
|
||||
switch-livingroom = mkSwitch "Switch Livingroom" {
|
||||
info = "TL-SG108";
|
||||
image = "${self}/topology-images/TL-SG108.png";
|
||||
interfaceGroups = [
|
||||
[
|
||||
"eth1"
|
||||
"eth2"
|
||||
"eth3"
|
||||
"eth4"
|
||||
"eth5"
|
||||
"eth6"
|
||||
"eth7"
|
||||
"eth8"
|
||||
]
|
||||
];
|
||||
connections = {
|
||||
eth2 = mkConnection "nswitch" "eth1";
|
||||
eth7 = mkConnection "pc" "eth1";
|
||||
eth8 = mkConnection "nbl-imba-2" "eth1";
|
||||
};
|
||||
};
|
||||
|
||||
nswitch = mkDevice "Nintendo Switch" {
|
||||
info = "Nintendo Switch";
|
||||
image = "${self}/topology-images/nintendo-switch.png";
|
||||
interfaces.eth1 = { };
|
||||
};
|
||||
|
||||
pc = mkDevice "Windows Gaming Server" {
|
||||
info = "i7-4790k, GTX970, 32GB RAM";
|
||||
image = "${self}/topology-images/pc.png";
|
||||
interfaces.eth1 = { };
|
||||
};
|
||||
|
||||
nbl-imba-2.interfaces.eth1 = { };
|
||||
|
||||
switch-bedroom = mkSwitch "Switch Bedroom" {
|
||||
info = "TL-SG1005D";
|
||||
image = "${self}/topology-images/TL-SG1005D.png";
|
||||
interfaceGroups = [
|
||||
[
|
||||
"eth1"
|
||||
"eth2"
|
||||
"eth3"
|
||||
"eth4"
|
||||
"eth5"
|
||||
]
|
||||
];
|
||||
connections.eth2 = mkConnection "printer" "eth1";
|
||||
};
|
||||
|
||||
printer = mkDevice "Printer" {
|
||||
info = "DELL C2665dnf";
|
||||
image = "${self}/topology-images/DELL-C2665dnf.png";
|
||||
interfaces.eth1 = { };
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
})
|
||||
|
||||
|
||||
];
|
||||
}
|
||||