add hm modules: riff
This commit is contained in:
parent
3c0f89c66a
commit
4b90002e45
6 changed files with 79 additions and 45 deletions
24
flake.lock
24
flake.lock
|
@ -454,11 +454,11 @@
|
||||||
"xdph": "xdph"
|
"xdph": "xdph"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1671841202,
|
"lastModified": 1671982931,
|
||||||
"narHash": "sha256-w6vfVa6gj48YWjK+GUezq5U3UkvvGo/DEzdhAmr9Mhw=",
|
"narHash": "sha256-cRInW7YYjw9xbjDTYOQD9PGo04aPAJWWu78PQ1HPkiQ=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "Hyprland",
|
"repo": "Hyprland",
|
||||||
"rev": "d87d2dac0b1385a4ab944df293bc48877564106c",
|
"rev": "cd08fa22fd1ddbb8604e42d01043617a8eb10520",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -581,11 +581,11 @@
|
||||||
"utils": "utils_4"
|
"utils": "utils_4"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1671843840,
|
"lastModified": 1672017029,
|
||||||
"narHash": "sha256-oYVOnPL+rpnDFKiNeEtSDiH1H2sMqpoJmCmtfcs8lT4=",
|
"narHash": "sha256-VGztJsDy094qcoaP5gxY0kqpcKGa7olw5v5W1yWqHoc=",
|
||||||
"owner": "jyooru",
|
"owner": "jyooru",
|
||||||
"repo": "nix-minecraft-servers",
|
"repo": "nix-minecraft-servers",
|
||||||
"rev": "5a5f7a399e40c0e258aa0fd00529613b5ae2b7e7",
|
"rev": "8ded123b238808a95e8f3e8588d1dcfb96bdfa65",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -800,11 +800,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1671936867,
|
"lastModified": 1671997655,
|
||||||
"narHash": "sha256-tOok3/MJWoRUEoPU5Ma/cTCeuw8ACx3Ozu1MlFcdvc8=",
|
"narHash": "sha256-8zUwvnJrBwiFIdw9VgARj1PIQsto5Spn9J5v34b0O7A=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "18ee49839ea8817218c3bfe3a62e06f47a10fdd5",
|
"rev": "aac1f0b25e6b04afad8e05dec5828f5c02398bd1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -886,11 +886,11 @@
|
||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1671975941,
|
"lastModified": 1672047887,
|
||||||
"narHash": "sha256-n5fEPkVVarOnmO70xxuMFlMwYiNQGEaFm/k1ebx/vMo=",
|
"narHash": "sha256-+Ckjrzz+mXVRB2fm12QEpa8Cz/9hm/48emkzyPxh97E=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "ce94b3d5d00080485f7a6dba0243a21d10c69273",
|
"rev": "0457d302f72e13b29dcf914f19b9616cbec5e44e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
{ inputs, lib, config, ... }: {
|
{ inputs, lib, config, ... }: {
|
||||||
# This file deals with everything requiring `inputs`, the rest being delagated to `common.nix`
|
# This file deals with everything requiring `inputs`, the rest being delagated to `common.nix`
|
||||||
# this is because we can't import inputs from all contexts as that can lead to infinite recursion.
|
# this is because we can't import inputs from all contexts as that can lead to infinite recursion.
|
||||||
imports = [
|
imports = [ ./common.nix inputs.vault-secrets.nixosModules.vault-secrets ];
|
||||||
./common.nix
|
|
||||||
inputs.vault-secrets.nixosModules.vault-secrets
|
|
||||||
];
|
|
||||||
|
|
||||||
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
|
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
|
||||||
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
nix.registry.nixpkgs.flake = inputs.nixpkgs;
|
||||||
|
|
||||||
|
home-manager.sharedModules = [ ./hm-modules ];
|
||||||
|
|
||||||
vault-secrets = let
|
vault-secrets = let
|
||||||
inherit (config.networking) domain hostName;
|
inherit (config.networking) domain hostName;
|
||||||
|
|
5
nixos/common/hm-modules/default.nix
Normal file
5
nixos/common/hm-modules/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{ ... }: {
|
||||||
|
imports = [
|
||||||
|
./riff.nix
|
||||||
|
];
|
||||||
|
}
|
28
nixos/common/hm-modules/riff.nix
Normal file
28
nixos/common/hm-modules/riff.nix
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
{ config, pkgs, lib, inputs, ... }:
|
||||||
|
with lib;
|
||||||
|
let cfg = config.programs.riff;
|
||||||
|
in {
|
||||||
|
options.programs.riff = {
|
||||||
|
enable = mkEnableOption "riff";
|
||||||
|
direnv = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable direnv support
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [ inputs.riff.packages.${pkgs.system}.riff ];
|
||||||
|
|
||||||
|
xdg.configFile."direnv/lib/riff.sh" = mkIf cfg.direnv {
|
||||||
|
executable = true;
|
||||||
|
text = ''
|
||||||
|
use_riff() {
|
||||||
|
watch_file Cargo.toml watch_file Cargo.lock
|
||||||
|
eval "$(riff --offline print-dev-env)"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -21,7 +21,6 @@ in {
|
||||||
gcc
|
gcc
|
||||||
gimp
|
gimp
|
||||||
inputs.comma.packages.${pkgs.system}.default
|
inputs.comma.packages.${pkgs.system}.default
|
||||||
inputs.riff.packages.${pkgs.system}.riff
|
|
||||||
inputs.webcord.packages.${pkgs.system}.default
|
inputs.webcord.packages.${pkgs.system}.default
|
||||||
jetbrains.clion
|
jetbrains.clion
|
||||||
jetbrains.idea-ultimate
|
jetbrains.idea-ultimate
|
||||||
|
@ -36,6 +35,11 @@ in {
|
||||||
yt-dlp
|
yt-dlp
|
||||||
];
|
];
|
||||||
|
|
||||||
|
programs.riff = {
|
||||||
|
enable = true;
|
||||||
|
direnv = true;
|
||||||
|
};
|
||||||
|
|
||||||
xdg.mimeApps.enable = true;
|
xdg.mimeApps.enable = true;
|
||||||
xdg.mimeApps.defaultApplications = {
|
xdg.mimeApps.defaultApplications = {
|
||||||
"text/html" = "firefox.desktop";
|
"text/html" = "firefox.desktop";
|
||||||
|
|
|
@ -3,32 +3,31 @@ let
|
||||||
inherit (builtins) filter attrValues concatLists;
|
inherit (builtins) filter attrValues concatLists;
|
||||||
|
|
||||||
# Helper function to resolve what should be imported depending on the type of config (lxc, vm, bare metal)
|
# Helper function to resolve what should be imported depending on the type of config (lxc, vm, bare metal)
|
||||||
resolve_imports =
|
resolve_imports = let
|
||||||
let
|
# lookup table
|
||||||
# lookup table
|
import_cases = {
|
||||||
import_cases = {
|
"lxc" = [
|
||||||
"lxc" = [
|
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
|
||||||
"${nixpkgs}/nixos/modules/virtualisation/lxc-container.nix"
|
./common/generic-lxc.nix
|
||||||
./common/generic-lxc.nix
|
];
|
||||||
];
|
"vm" = [ ./common/generic-vm.nix ];
|
||||||
"vm" = [
|
"local" = [ hyprland.nixosModules.default ];
|
||||||
./common/generic-vm.nix
|
};
|
||||||
];
|
in { hostname, realm, profile ? hostname, type ? "lxc", ... }:
|
||||||
"local" = [
|
[
|
||||||
hyprland.nixosModules.default
|
home-manager.nixosModules.home-manager
|
||||||
];
|
mailserver.nixosModules.mailserver
|
||||||
};
|
./common
|
||||||
in
|
"${./.}/hosts/${realm}/${profile}/configuration.nix"
|
||||||
{ hostname, realm, profile ? hostname, type ? "lxc", ... }: [
|
] ++ import_cases.${type};
|
||||||
home-manager.nixosModules.home-manager
|
in {
|
||||||
mailserver.nixosModules.mailserver
|
|
||||||
./common
|
|
||||||
"${./.}/hosts/${realm}/${profile}/configuration.nix"
|
|
||||||
] ++ import_cases.${type};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# Add to whatever realm a host belong to its list of tags
|
# Add to whatever realm a host belong to its list of tags
|
||||||
add_realm_to_tags = realm: map ({ tags ? [ ], ... }@host: host // { tags = [ realm ] ++ tags; inherit realm; });
|
add_realm_to_tags = realm:
|
||||||
|
map ({ tags ? [ ], ... }@host:
|
||||||
|
host // {
|
||||||
|
tags = [ realm ] ++ tags;
|
||||||
|
inherit realm;
|
||||||
|
});
|
||||||
# Flatten all hosts to a single list
|
# Flatten all hosts to a single list
|
||||||
flatten_hosts = hosts: concatLists (attrValues hosts);
|
flatten_hosts = hosts: concatLists (attrValues hosts);
|
||||||
# Filter out all hosts which aren't nixos
|
# Filter out all hosts which aren't nixos
|
||||||
|
@ -39,8 +38,7 @@ in
|
||||||
let
|
let
|
||||||
# this makes local apply work a bit nicer
|
# this makes local apply work a bit nicer
|
||||||
name = if realm == "thalassa" then hostname else "${hostname}.${realm}";
|
name = if realm == "thalassa" then hostname else "${hostname}.${realm}";
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
"${name}" = {
|
"${name}" = {
|
||||||
imports = resolve_imports host;
|
imports = resolve_imports host;
|
||||||
networking = {
|
networking = {
|
||||||
|
|
Loading…
Reference in a new issue