From b58b51253832405968c634595734b68439e1053f Mon Sep 17 00:00:00 2001 From: Vivian Roest Date: Sun, 6 Nov 2022 13:04:41 +0100 Subject: [PATCH] repl.nix --- flake.lock | 18 +++++------ flake.nix | 9 ++++-- nixos/hosts/thalassa/null/configuration.nix | 7 ++--- nixos/hosts/thalassa/null/home/default.nix | 1 + nixos/hosts/thalassa/null/home/hyprland.nix | 3 ++ notes/ideas.md | 33 +++++++++++++++++++++ repl.nix | 10 +++++++ 7 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 notes/ideas.md create mode 100644 repl.nix diff --git a/flake.lock b/flake.lock index 523c8daf..958e8038 100644 --- a/flake.lock +++ b/flake.lock @@ -340,11 +340,11 @@ "utils": "utils_2" }, "locked": { - "lastModified": 1667574732, - "narHash": "sha256-73TVk3uSQOja6Q/5OuNcpcqwo6+SMzJPRtYAjU0rBx4=", + "lastModified": 1667691670, + "narHash": "sha256-9MgKg5LbTRuZ6oonP49go4jcUzkTOhVD3ZnQsi9aWM0=", "owner": "nix-community", "repo": "home-manager", - "rev": "b764068a506c6f70dba998efa0e7fcb99cb4deb2", + "rev": "c5adf29545b553089ccf9c28b68973ce6f812c1c", "type": "github" }, "original": { @@ -359,11 +359,11 @@ "wlroots": "wlroots" }, "locked": { - "lastModified": 1667671515, - "narHash": "sha256-jdhA2R+Ezam6R++BYId1jwdvgZn6VZDnG4oEK+R8KIQ=", + "lastModified": 1667673266, + "narHash": "sha256-grIxeuXZjil9dj97/RW1Jhf+8dsCKfzop4PR2CqOrgo=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "bee06f35073da245b71221897becc74260a5b51f", + "rev": "976b44443ae1603699a5fc4ef1eb3c6e0f5886c8", "type": "github" }, "original": { @@ -623,11 +623,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1667550944, - "narHash": "sha256-8qNYarOJtasZ/+G5mlNC2mh8VG5NagM6tSpK2Rq5hDk=", + "lastModified": 1667683652, + "narHash": "sha256-We3GMb6c+TRBj2Dvh5Hv/TFEZKejlvLAFg9Z3Ge3/dA=", "owner": "NULLx76", "repo": "nixpkgs", - "rev": "afc2d0fe2359d4f4eff4d003f41130ad52ab427e", + "rev": "d5c95ef578f32febb1f7da817df1496336e82faa", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e3a91f55..71f1eea9 100644 --- a/flake.nix +++ b/flake.nix @@ -71,12 +71,16 @@ }; # Script to apply local colmena deployments - apply-local = pkgs.writeScriptBin "apply-local" '' - #!${pkgs.stdenv.shell} + apply-local = pkgs.writeShellScriptBin "apply-local" '' "${ colmena.packages.${system}.colmena }"/bin/colmena apply-local --sudo $@ ''; + + fast-repl = pkgs.writeShellScriptBin "fast-repl" '' + source /etc/set-environment + nix repl --file "${./.}/repl.nix" $@ + ''; in { # Make the nixosConfigurations for compat reasons nixosConfigurations = @@ -131,6 +135,7 @@ vault (vault-push-approle-envs self { }) (vault-push-approles self { }) + fast-repl ]; }; }; diff --git a/nixos/hosts/thalassa/null/configuration.nix b/nixos/hosts/thalassa/null/configuration.nix index 5aa6820e..47247cbc 100644 --- a/nixos/hosts/thalassa/null/configuration.nix +++ b/nixos/hosts/thalassa/null/configuration.nix @@ -30,8 +30,7 @@ let exec Hyprland ''; -in -{ +in { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -86,9 +85,7 @@ in loader.efi.canTouchEfiVariables = true; loader.efi.efiSysMountPoint = "/boot/efi"; - kernel.sysctl = { - "fs.inotify.max_user_watches" = 524288; - }; + kernel.sysctl = { "fs.inotify.max_user_watches" = 524288; }; }; services.gnome.gnome-keyring.enable = true; diff --git a/nixos/hosts/thalassa/null/home/default.nix b/nixos/hosts/thalassa/null/home/default.nix index 9f6026bc..e60ec89e 100644 --- a/nixos/hosts/thalassa/null/home/default.nix +++ b/nixos/hosts/thalassa/null/home/default.nix @@ -23,6 +23,7 @@ in { btop calibre cinny-desktop + discord-canary element-desktop-wayland fluxcd fusee-launcher diff --git a/nixos/hosts/thalassa/null/home/hyprland.nix b/nixos/hosts/thalassa/null/home/hyprland.nix index c0428787..7329a2f5 100644 --- a/nixos/hosts/thalassa/null/home/hyprland.nix +++ b/nixos/hosts/thalassa/null/home/hyprland.nix @@ -23,6 +23,9 @@ enable = true; recommendedEnvironment = true; extraConfig = '' + exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + exec-once=systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP + monitor=eDP-1,1920x1080@60,0x0,1 monitor=eDP-1,addreserved,0,0,48,0 monitor=,preferred,auto,1 diff --git a/notes/ideas.md b/notes/ideas.md new file mode 100644 index 00000000..455de91b --- /dev/null +++ b/notes/ideas.md @@ -0,0 +1,33 @@ +# 1. Add port info to hosts +Re-use `hosts` setup and add domain and port information to each host +```nix +{ + hostname = "overseerr"; + ip = "192.168.0.105"; + mac = "8E:21:7F:88:3A:83"; + # new stuff + exposes = { + requests = { + port = 3000; + domain = "requests.xirion.net"; + port = 3000; + }; + ... + }; +} +``` +which then can get translated to nginx config: +```nix +virtualHosts."requests.xirion.net" = proxy "http://192.168.0.105:80"; +``` + +Ideally hosts should also be able to access their own host information more easily so +that in service config one could use `thisHost.exposes.requests.port` or similar + +# 2. Authoritative nameserver +Using the definitions from (1), we can then also build authoritative DNS records +by folding over `hosts[i].exposes.requests.domain` and collating that with its realm (and therefore external IP) + +This also means I should probably put the external IP in some kind of meta block per realm. + +[dns.nix](https://github.com/kirelagin/dns.nix) seems to be a nice DSL for DNS stuff diff --git a/repl.nix b/repl.nix new file mode 100644 index 00000000..77ee9d67 --- /dev/null +++ b/repl.nix @@ -0,0 +1,10 @@ +let + flake = builtins.getFlake (toString ./.); + nixpkgs = import { }; +in +{ inherit flake; } +// flake +// builtins +// nixpkgs +// nixpkgs.lib +// flake.nixosConfigurations