From beb72457588f93769a3055c31552ca4565804490 Mon Sep 17 00:00:00 2001 From: Jaculabilis Date: Mon, 28 Nov 2022 16:43:16 +0000 Subject: [PATCH] Add stagirite WSL configs --- flake.lock | 83 +++++++++++++++++++++++++++++++---- flake.nix | 8 +++- machine/stagirite/default.nix | 70 +++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 9 deletions(-) create mode 100644 machine/stagirite/default.nix diff --git a/flake.lock b/flake.lock index d268ce2..6c2877a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,19 +1,69 @@ { "nodes": { - "nixpkgs": { + "flake-compat": { + "flake": false, "locked": { - "lastModified": 1669052418, - "narHash": "sha256-M1I4BKXBQm2gey1tScemEh5TpHHE3gKptL7BpWUvL8s=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8", + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", "type": "github" }, "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixos-wsl": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1669627414, + "narHash": "sha256-9k62MwUC+poOn1wS3Yp6sE0nt7gzOtE1iXGJ0F/5bis=", + "owner": "nix-community", + "repo": "NixOS-WSL", + "rev": "2bb34d04bc866ae4cecd5d23d7fda36bb4832f60", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NixOS-WSL", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1667653703, + "narHash": "sha256-Xow4vx52/g5zkhlgZnMEm/TEXsj+13jTPCc2jIhW1xU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8", + "rev": "f09ad462c5a121d0239fde645aacb2221553a217", "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-22.05", + "type": "indirect" } }, "nixpkgs-empyrean": { @@ -32,9 +82,26 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1669052418, + "narHash": "sha256-M1I4BKXBQm2gey1tScemEh5TpHHE3gKptL7BpWUvL8s=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8", + "type": "github" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs", + "nixos-wsl": "nixos-wsl", + "nixpkgs": "nixpkgs_2", "nixpkgs-empyrean": "nixpkgs-empyrean" } } diff --git a/flake.nix b/flake.nix index 463b1c2..4732107 100644 --- a/flake.nix +++ b/flake.nix @@ -2,9 +2,10 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs?rev=20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8"; nixpkgs-empyrean.url = "github:NixOS/nixpkgs?rev=2ebb6c1e5ae402ba35cca5eec58385e5f1adea04"; + nixos-wsl.url = github:nix-community/NixOS-WSL; }; - outputs = { self, nixpkgs, nixpkgs-empyrean }: { + outputs = { self, nixpkgs, nixpkgs-empyrean, nixos-wsl }@attrs: { nixosConfigurations.catacomb = nixpkgs.lib.nixosSystem { system = "aarch64-linux"; modules = [ ./machine/catacomb ]; @@ -13,5 +14,10 @@ system = "x86_64-linux"; modules = [ ./machine/empyrean ]; }; + nixosConfigurations.stagirite = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = attrs; + modules = [ ./machine/stagirite ]; + }; }; } diff --git a/machine/stagirite/default.nix b/machine/stagirite/default.nix new file mode 100644 index 0000000..1eddf4c --- /dev/null +++ b/machine/stagirite/default.nix @@ -0,0 +1,70 @@ +{ lib, pkgs, config, modulesPath, nixos-wsl, ... }: + +with lib; +let + wp = { addr = "localhost"; port = 4567; }; +in +{ + imports = [ + "${modulesPath}/profiles/minimal.nix" + + nixos-wsl.nixosModules.wsl + ]; + + wsl = { + enable = true; + wslConf.automount.root = "/mnt"; + defaultUser = "nixos"; + startMenuLaunchers = true; + }; + + system.stateVersion = "21.11"; + + networking.hostName = "stagirite"; + + fileSystems.winssh = { + device = "C:/Users/tvb/.ssh"; + fsType = "drvfs"; + options = [ "ro" "noatime" "uid=1000" "gid=100" "case=off" "umask=0077" "fmask=0177" "metadata" ]; + depends = [ "/" ]; + mountPoint = "/home/nixos/.ssh"; + }; + + documentation.enable = true; + documentation.man.enable = true; + documentation.dev.enable = true; + + # Enable nix flakes + nix.package = pkgs.nixFlakes; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + + environment.systemPackages = + [ + pkgs.vim pkgs.git + pkgs.nmap + (pkgs.python3.withPackages (pypkgs: [ pypkgs.poetry ])) + pkgs.htop pkgs.wget + pkgs.gcc + ]; + environment.variables = { + EDITOR = "vim"; + }; + + #services.code-server.enable = true; + #services.code-server.extraPackages = [ pkgs.bashInteractive ]; + + services.openssh.enable = true; + + #services.wordpress.webserver = "nginx"; + #services.wordpress.sites.${wp.addr} = { + # extraConfig = '' + # define('WPSITEURL','http://${wp.addr}:${toString wp.port}/'); + # define('WPHOME','http://${wp.addr}:${toString wp.port}/'); + # ''; + #}; + #services.nginx.virtualHosts.${wp.addr} = { + # listen = [ wp ]; + #}; +}