addin ssh key

This commit is contained in:
2023-11-21 14:00:06 +00:00
parent 4178372853
commit 54c3d889ab
33 changed files with 873 additions and 829 deletions

View File

@@ -1,7 +1,12 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{ lib, config, pkgs, modulesPath, ... }: {
{
lib,
config,
pkgs,
modulesPath,
...
}: {
# You can import other NixOS modules here
imports = [
@@ -10,7 +15,6 @@
# Include static network settings.
./networking.nix
"${modulesPath}/virtualisation/hyperv-image.nix"
];
nixpkgs = {config = {allowUnfree = true;};};
@@ -41,7 +45,4 @@
environment.etc."ssh/ssh_host_ed25519_key".source = ./ssh/ssh_host_ed25519_key;
environment.etc."ssh/ssh_host_ed25519_key".mode = "0400";
environment.etc."ssh/ssh_host_ed25519_key.pub".source = ./ssh/ssh_host_ed25519_key.pub;
}

View File

@@ -14,7 +14,6 @@
boot.initrd.kernelModules = [];
boot.kernelModules = ["hv_sock"];
# fileSystems."/" = {
# device = "/dev/disk/by-label/nixos";
# autoResize = true;
@@ -35,5 +34,4 @@
# in ["${automount_opts},credentials=/etc/nixos/smb-secrets"];
in ["${automount_opts}"];
};
}

View File

@@ -1,5 +1,9 @@
{ lib, config, pkgs, ... }: {
{
lib,
config,
pkgs,
...
}: {
# You can import other NixOS modules here
hyperv = {
baseImageSize = 8096;

View File

@@ -21,7 +21,10 @@
# nix-colors.url = "github:misterio77/nix-colors";
nixos-hardware.url = "github:NixOS/nixos-hardware"; # Import nixos hardware quirks settings
# nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs";}; #import nixos-generators for building images
nixos-wsl = {url = "github:nix-community/nixos-wsl"; inputs.nixpkgs.follows = "nixpkgs";};
nixos-wsl = {
url = "github:nix-community/nixos-wsl";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix.url = github:Mic92/sops-nix;
flake-utils.url = "github:numtide/flake-utils";
# nix.url = "github:NixOS/nix/2.12.0";
@@ -45,18 +48,22 @@
# Flake Utility Functions
utils.url = "github:gytis-ivaskevicius/flake-utils-plus";
};
outputs = { self, nixpkgs, home-manager,nixpkgs-unstable,... }@inputs:
let
outputs = {
self,
nixpkgs,
home-manager,
nixpkgs-unstable,
...
} @ inputs: let
inherit (lib.my) mapModules mapModulesRec mapHosts;
inherit (self) outputs;
system = "x86_64-linux";
mkPkgs = pkgs: extraOverlays: import pkgs {
mkPkgs = pkgs: extraOverlays:
import pkgs {
inherit system;
config.allowUnfree = true; # forgive me Stallman senpai
overlays = extraOverlays ++ (lib.attrValues self.overlays);
@@ -64,26 +71,32 @@
pkgs = mkPkgs nixpkgs [self.overlay];
pkgs' = mkPkgs nixpkgs-unstable [];
lib = nixpkgs.lib.extend
(self: super: { my = import ./lib { inherit pkgs inputs outputs; lib = self; }; }// home-manager.lib);
lib =
nixpkgs.lib.extend
(self: super:
{
my = import ./lib {
inherit pkgs inputs outputs;
lib = self;
};
}
// home-manager.lib);
in {
lib = lib.my;
packages."${system}" =
mapModules ./pkgs (p: pkgs.callPackage p {});
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
devShell."${system}" =
import ./shell.nix {inherit pkgs;};
overlay =
final: prev: {
overlay = final: prev: {
#unstable = pkgs';
my = self.packages."${system}";
};
overlays = import ./overlays {inherit inputs;};
# Output all modules in ./modules to flake. Modules should be in
# individual subdirectories and contain a default.nix file
nixosModules = builtins.listToAttrs (map
@@ -93,7 +106,6 @@
})
(builtins.attrNames (builtins.readDir ./modules/nixos)));
##import our HM modules
## -- imported in ./home-manger/general
@@ -104,7 +116,6 @@
})
(builtins.attrNames (builtins.readDir ./modules/home-manager)));
# nixosConfigurations =
# mapHosts ./hosts {};
@@ -112,18 +123,23 @@
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
go3-wsl = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs lib;hostName = "go3-wsl"; };
specialArgs = {
inherit inputs outputs lib;
hostName = "go3-wsl";
};
modules = [
./hosts/go3-wsl
];
};
StuPC-WSL = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs lib; hostName = "StuPC";};
specialArgs = {
inherit inputs outputs lib;
hostName = "StuPC";
};
modules = [
./hosts/StuPC-WSL
];
};
};
# Standalone home-manager configuration entrypoint
@@ -133,7 +149,10 @@
"sstent@go3-wsl" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
pkgs = pkgs;
extraSpecialArgs = { inherit inputs outputs lib; hostName = "go3-wsl"; };
extraSpecialArgs = {
inherit inputs outputs lib;
hostName = "go3-wsl";
};
modules = [
# > Our main home-manager configuration file <
./home-manager/users/sstent
@@ -143,7 +162,10 @@
"sstent@StuPC-WSL" = home-manager.lib.homeManagerConfiguration {
# pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
pkgs = pkgs;
extraSpecialArgs = { inherit inputs outputs lib; hostName = "StuPC-WSL";};
extraSpecialArgs = {
inherit inputs outputs lib;
hostName = "StuPC-WSL";
};
modules = [
# > Our main home-manager configuration file <
./home-manager/users/sstent
@@ -151,6 +173,5 @@
];
};
};
};
}

View File

@@ -1,13 +1,18 @@
{ inputs, lib, pkgs, config, outputs, ... }:
{
imports = [
inputs,
lib,
pkgs,
config,
outputs,
...
}: {
imports =
[
# ./beets.nix
# ./keybase.nix
"${inputs.vscode-server}/modules/vscode-server/home.nix"
] ++ (builtins.attrValues outputs.homeManagerModules);
]
++ (builtins.attrValues outputs.homeManagerModules);
###dotfiles path variable
options._dotfiles = lib.mkOption {
@@ -23,7 +28,6 @@
description = "Path to the Secrets runtime";
};
###secretstore path variable
options._secretstore = lib.mkOption {
type = lib.types.str;
@@ -32,14 +36,11 @@
};
config = {
nixpkgs = {
overlays = builtins.attrValues outputs.overlays;
config = {
allowUnfree = true;
allowUnfreePredicate = (_: true);
allowUnfreePredicate = _: true;
};
};
@@ -56,7 +57,6 @@ config = {
services.vscode-server.enableFHS = true;
services.vscode-server.nodejsPackage = pkgs.nodejs-18_x;
programs = {
home-manager.enable = true;
git.enable = true;

View File

@@ -1,7 +1,12 @@
{ inputs, outputs, lib, config, pkgs, hostName, ... }:
{
inputs,
outputs,
lib,
config,
pkgs,
hostName,
...
}: {
imports = [
../../global.nix
];
@@ -21,8 +26,6 @@
};
};
# home.file."/home/sstent/.config/beets/test".source = config.lib.file.mkOutOfStoreSymlink /run/user/1000/secrets/test;
# Let Home Manager install and manage itself.
@@ -96,7 +99,6 @@
userName = "sstent";
userEmail = "stuart.stent@gmail.com";
extraConfig = {pull.rebase = true;};
};
ssh = {
enable = true;
@@ -114,9 +116,7 @@
};
};
};
}
#######If Gnome
# config = lib.mkIf config.mymods.gnome.enable {
# programs.bash.enable = true;
@@ -166,7 +166,6 @@
# ];
# };
# "org/gnome/desktop/interface" = { color-scheme = "prefer-dark"; };
# };
# };

View File

@@ -1,6 +1,6 @@
{pkgs}:
pkgs.python3.withPackages (p: with p; [
pkgs.python3.withPackages (p:
with p; [
requests # HTTP library
setuptools # setup.py
paramiko # ssh library

View File

@@ -1,5 +1,10 @@
{ lib, pkgs, config, inputs, ... }: {
{
lib,
pkgs,
config,
inputs,
...
}: {
imports = [
../common.nix
../user-sstent.nix
@@ -15,6 +20,4 @@
syncthing.enable = true;
wsl.enable = true;
};
}

View File

@@ -1,10 +1,18 @@
# This file (and the global directory) holds config that i use on all hosts
{ lib, inputs, outputs, pkgs, config, ... }:
{
imports = [
lib,
inputs,
outputs,
pkgs,
config,
...
}: {
imports =
[
inputs.home-manager.nixosModules.home-manager
inputs.sops-nix.nixosModules.sops
]++ (builtins.attrValues outputs.nixosModules);
]
++ (builtins.attrValues outputs.nixosModules);
###dotfiles path variable
options._dotfiles = lib.mkOption {
@@ -20,7 +28,6 @@
description = "Path to the Secrets runtime";
};
###secretstore path variable
options._secretstore = lib.mkOption {
type = lib.types.str;
@@ -31,13 +38,11 @@
config = {
system.stateVersion = "23.05";
sops = {
defaultSopsFile = "${config._secretstore}/host-secrets.yaml";
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
};
home-manager = {
useUserPackages = true;
extraSpecialArgs = {inherit inputs outputs;};
@@ -60,7 +65,6 @@ nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
# nix.nixPath = [ "nixpkgs=pkgs.outPath" ];
networking.search = ["node.dc1.consul" "service.dc1.consul"];
#services.envfs.enable = true;
environment.systemPackages = [
pkgs.git
@@ -76,6 +80,5 @@ nix.gc = {
dates = "03:15"; # When to run the garbage collector
options = "-d"; # Arguments to pass to nix-collect-garbage
};
};
}

View File

@@ -1,5 +1,10 @@
{ lib, pkgs, config, inputs, ... }: {
{
lib,
pkgs,
config,
inputs,
...
}: {
imports = [
../common.nix
../user-sstent.nix
@@ -16,5 +21,4 @@
syncthing.enable = true;
wsl.enable = true;
};
}

View File

@@ -1,6 +1,9 @@
{ inputs, lib, config, ... }:
{
inputs,
lib,
config,
...
}: {
sops.secrets.sstent_password = {
#sopsFile = ./secrets.yaml;
neededForUsers = true;
@@ -16,10 +19,8 @@
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+D4o3mL4BQsRr0UIhB1hn0brSTIJ9Lr0m2fMMVGF3tIuEihnmwGTeAX78q5/bmoo4gZy7G+CHal54S1lY8LY1KvmIDCpPJ8848HvLbTiTX3qZ7Mjaav+Ox9eHMwX+7zkPwdhfP8TDvmNe12j1GEKBhAm+FhdBQCbEV7cbm1SkX0+WBGoVvI2qbRm1RF0mOuTAmO3Lr2YeAcKJ21YxwNMv1Qrj7oxGYH9rLHLNwZ/0soIdTC9cikl4DHyvCs4HRYcVw36uuCVc/AyIT2GeETRapAQr8nzT89Haa1IThgZ9ztjSsSSOtrUhxatlMIfTIpVjl/gWq7GLfqd/ei/evTal sstent@StuPC"
];
extraGroups = ["wheel" "video"];
};
};
# home-manager.users.misterio = import home/${config.networking.hostName}.nix;
}

View File

@@ -1,8 +1,6 @@
{lib, ...}:
with builtins;
with lib;
rec {
with lib; rec {
# attrsToList
attrsToList = attrs:
mapAttrsToList (name: value: {inherit name value;}) attrs;

View File

@@ -10,22 +10,26 @@
# map = callLibs ./map.nix;
# ## In configs, they can be used under "lib.our"
# })
{ inputs, lib, pkgs, ... }:
let
{
inputs,
lib,
pkgs,
...
}: let
inherit (lib) makeExtensible attrValues foldr;
inherit (modules) mapModules;
modules = import ./modules.nix {
inherit lib;
self.attrs = import ./attrs.nix { inherit lib; self = {}; };
self.attrs = import ./attrs.nix {
inherit lib;
self = {};
};
};
mylib = makeExtensible (self:
with self; mapModules ./.
with self;
mapModules ./.
(file: import file {inherit self lib pkgs inputs;}));
in
mylib.extend

View File

@@ -1,10 +1,12 @@
{ lib, pkgs, ... }:
with builtins;
with lib;
{
toCSSFile = file:
let fileName = removeSuffix ".scss" (baseNameOf file);
lib,
pkgs,
...
}:
with builtins;
with lib; {
toCSSFile = file: let
fileName = removeSuffix ".scss" (baseNameOf file);
compiledStyles =
pkgs.runCommand "compileScssFile"
{buildInputs = [pkgs.sass];} ''
@@ -18,8 +20,8 @@ with lib;
'';
in "${compiledStyles}/${fileName}.css";
toFilteredImage = imageFile: options:
let result = "result.png";
toFilteredImage = imageFile: options: let
result = "result.png";
filteredImage =
pkgs.runCommand "filterWallpaper"
{buildInputs = [pkgs.imagemagick];} ''

View File

@@ -11,7 +11,6 @@
hasSuffix
mapAttrs'
nameValuePair
;
in rec {
filter = name: func: attrs: filterAttrs name (mapAttrs' func attrs);
@@ -26,7 +25,6 @@ in rec {
sopsFile = dir + "/${name}";
format = "binary";
path = out_dir + "/${name}";
}
else nameValuePair "" null) (readDir dir);
}

View File

@@ -1,23 +1,28 @@
{ self, lib, ... }:
let
{
self,
lib,
...
}: let
inherit (builtins) attrValues readDir pathExists concatLists;
inherit (lib) id mapAttrsToList filterAttrs hasPrefix hasSuffix nameValuePair removeSuffix;
inherit (self.attrs) mapFilterAttrs;
in
rec {
in rec {
mapModules = dir: fn:
mapFilterAttrs
(n: v:
v != null &&
!(hasPrefix "_" n))
(n: v:
let path = "${toString dir}/${n}"; in
v
!= null
&& !(hasPrefix "_" n))
(n: v: let
path = "${toString dir}/${n}";
in
if v == "directory" && pathExists "${path}/default.nix"
then nameValuePair n (fn path)
else if v == "regular" &&
n != "default.nix" &&
hasSuffix ".nix" n
else if
v
== "regular"
&& n != "default.nix"
&& hasSuffix ".nix" n
then nameValuePair (removeSuffix ".nix" n) (fn path)
else nameValuePair "" null)
(readDir dir);
@@ -28,10 +33,12 @@ rec {
mapModulesRec = dir: fn:
mapFilterAttrs
(n: v:
v != null &&
!(hasPrefix "_" n))
(n: v:
let path = "${toString dir}/${n}"; in
v
!= null
&& !(hasPrefix "_" n))
(n: v: let
path = "${toString dir}/${n}";
in
if v == "directory"
then nameValuePair n (mapModulesRec path fn)
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n
@@ -39,8 +46,7 @@ rec {
else nameValuePair "" null)
(readDir dir);
mapModulesRec' = dir: fn:
let
mapModulesRec' = dir: fn: let
dirs =
mapAttrsToList
(k: _: "${dir}/${k}")
@@ -49,5 +55,6 @@ rec {
(readDir dir));
files = attrValues (mapModules dir id);
paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs);
in map fn paths;
in
map fn paths;
}

View File

@@ -1,8 +1,12 @@
{ inputs, lib, pkgs, ... }:
{
inputs,
lib,
pkgs,
...
}:
with lib;
with lib.my;
let sys = "x86_64-linux";
with lib.my; let
sys = "x86_64-linux";
in {
mkHost = path: attrs @ {system ? sys, ...}:
nixosSystem {

View File

@@ -1,16 +1,14 @@
{ lib, ... }:
let
{lib, ...}: let
inherit (lib) mkOption types;
in
rec {
in rec {
mkOpt = type: default:
mkOption {inherit type default;};
mkOpt' = type: default: description:
mkOption {inherit type default description;};
mkBoolOpt = default: mkOption {
mkBoolOpt = default:
mkOption {
inherit default;
type = types.bool;
example = true;

View File

@@ -1,7 +1,11 @@
{ config, pkgs, lib, ... }:
with lib;
let cfg = config.custom.beets;
{
config,
pkgs,
lib,
...
}:
with lib; let
cfg = config.custom.beets;
in {
options.custom.beets = {
enable = mkOption {
@@ -16,7 +20,6 @@ in {
pkgs.ffmpeg # for replaygain
];
sops = {
secrets.discogs_json = {
path = "${config.xdg.configHome}/beets/discogs_token.json";
@@ -93,8 +96,7 @@ in {
isMultidisc = "1 if disctotal > 1 else 0";
myBitDepth = "('' if bitdepth != 24 else '[24bit - '+ media + ']')";
myDisc = "('' if disctotal <= 1 else str(disc) + ' - ')";
mySongartist =
"artist + ' - ' if artist != albumartist and artist != '' else ''";
mySongartist = "artist + ' - ' if artist != albumartist and artist != '' else ''";
};
library = "~/musiclibrary.db";
match = {
@@ -123,8 +125,7 @@ in {
};
missing = {
format_album = "$albumartist: ($year) $album $albumtype $atype";
format_item =
"$albumartist - $album [$albumtype]$atype: $track/$tracktotal $title";
format_item = "$albumartist - $album [$albumtype]$atype: $track/$tracktotal $title";
};
musicbrainz = {
pass = "7ANCLPczDNFn6Sf65vdZ";
@@ -132,12 +133,9 @@ in {
};
original_date = true;
paths = {
"albumtype:soundtrack" =
"Soundtracks/$albumartist - $album%aunique{} ($year)/$myDisc$track - $artist - $title";
comp =
"Compilations/$albumartist/($year) $album%aunique{}/$myDisc$track - $artist - $title";
default =
"%if{$artist_grouping,$artist_grouping/}$first_artist/$year - $album $atype%aunique{media}[%upper{$format}$bitdepth]%if{$media,[$media]}/%if{$isMultidisc,$disc - }$track - $mySongartist$title";
"albumtype:soundtrack" = "Soundtracks/$albumartist - $album%aunique{} ($year)/$myDisc$track - $artist - $title";
comp = "Compilations/$albumartist/($year) $album%aunique{}/$myDisc$track - $artist - $title";
default = "%if{$artist_grouping,$artist_grouping/}$first_artist/$year - $album $atype%aunique{media}[%upper{$format}$bitdepth]%if{$media,[$media]}/%if{$isMultidisc,$disc - }$track - $mySongartist$title";
};
per_disc_numbering = true;
plugins = [
@@ -160,19 +158,15 @@ in {
rewrite = {
"artist Björk & Tríó Guðmundar Ingólfssonar" = "Björk";
"artist Brant Bjork and The Low Desert Punk Band" = "Brant Bjork";
"artist King Gizzard & The Lizard Wizard with Mild High Club" =
"King Gizzard & The Lizard Wizard";
"artist King Gizzard & The Lizard Wizard with Mild High Club" = "King Gizzard & The Lizard Wizard";
"artist Kyuss _ Queens of the Stone Age" = "Kyuss";
"artist Professor Elemental & Tom Caruana" = "Professor Elemental";
"artist Resin Dogs Feat Spikey Tee" = "Resin Dogs";
"artist Sepultura _ Exodus" = "Sepultura";
"artist The Knife in collaboration with Mount Sims and Planningtorock" =
"The Knife";
"artist The Knife in collaboration with Mount Sims and Planningtorock" = "The Knife";
"artist Unida _ Dozer" = "Unida";
};
};
};
};
}

View File

@@ -1,11 +1,17 @@
{ config, pkgs, inputs, lib, util, hostName, ... }:
{
config,
pkgs,
inputs,
lib,
util,
hostName,
...
}:
with lib;
with lib.my;
let
with lib.my; let
cfg = config.custom.keybase;
username = config.home.username;
secretstore = config._secretstore;
in {
options.custom.keybase = {
enable = mkOption {
@@ -15,7 +21,6 @@ in {
};
};
config = mkIf cfg.enable {
services.keybase.enable = true;
services.kbfs.enable = true;
@@ -27,4 +32,3 @@ in {
};
};
}

View File

@@ -1,7 +1,11 @@
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.custom.ssh-proxy;
{
lib,
pkgs,
config,
...
}:
with lib; let
cfg = config.custom.ssh-proxy;
in {
options.custom.ssh-proxy = {
enable = mkOption {
@@ -14,19 +18,19 @@ in {
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
npiperelay
socat
];
systemd.user = {
startServices = true;
services.ssh-proxy = {
Unit = { Description = "WSL Proxy"; After = "sops-nix.service";};
Unit = {
Description = "WSL Proxy";
After = "sops-nix.service";
};
Install = {WantedBy = ["default.target"];};
Service = {
ExecStart = "${pkgs.writeShellScript "start-proxy" ''
@@ -35,10 +39,7 @@ ${pkgs.coreutils}/bin/rm -f /home/sstent/.ssh/wsl-ssh-agent.sock
${pkgs.util-linux}/bin/setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/home/sstent/.ssh/wsl-ssh-agent.sock,fork EXEC:"${pkgs.npiperelay}/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork
''}";
};
};
};
};
}

View File

@@ -1,13 +1,16 @@
{ lib, inputs, outputs, config, ... }:
with lib;
let cfg = config.custom.mnt_public;
{
lib,
inputs,
outputs,
config,
...
}:
with lib; let
cfg = config.custom.mnt_public;
in {
options.custom.mnt_public.enable = mkEnableOption "Enable mnt/Public";
config = mkIf cfg.enable {
fileSystems."/mnt/Public" = {
device = "//192.168.1.109/Public";
fsType = "cifs";
@@ -16,4 +19,3 @@ in {
};
};
}

View File

@@ -1,9 +1,12 @@
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.custom.sshd;
{
lib,
pkgs,
config,
...
}:
with lib; let
cfg = config.custom.sshd;
in {
#define option to enable this
options.custom.sshd.enable = mkEnableOption "Enable SSH";
@@ -15,6 +18,5 @@ services.openssh = {
};
networking.firewall.allowedTCPPorts = [22];
};
}

View File

@@ -1,12 +1,16 @@
{ lib, inputs, outputs, config, ... }:
with lib;
let cfg = config.custom.syncthing;
{
lib,
inputs,
outputs,
config,
...
}:
with lib; let
cfg = config.custom.syncthing;
in {
options.custom.syncthing.enable = mkEnableOption "Enable mnt/Public";
config = mkIf cfg.enable {
services.syncthing = {
enable = true;
dataDir = "/home/sstent";

View File

@@ -1,19 +1,20 @@
{ lib, pkgs, config, ... }:
with lib;
let
{
lib,
pkgs,
config,
...
}:
with lib; let
secretstore = config._secretstore;
host = config.networking.hostName;
cfg = config.custom.mullvad;
secret = if builtins.pathExists "${secretstore}/hosts/${host}/mullvad/device.json" then
./secrets.nix
else
{ };
secret =
if builtins.pathExists "${secretstore}/hosts/${host}/mullvad/device.json"
then ./secrets.nix
else {};
in {
#define option to enable this
options.custom.mullvad.enable = mkEnableOption "Enable SSH";
@@ -33,9 +34,5 @@ in {
${pkgs.mullvad}/bin/mullvad relay set location ca mtr
'';
};
};
}

View File

@@ -1,23 +1,18 @@
{ lib, pkgs, config, ... }:
with lib;
let
{
lib,
pkgs,
config,
...
}:
with lib; let
secretstore = config._secretstore;
host = config.networking.hostName;
secretpath = "${secretstore}/hosts/${host}/mullvad/device.json";
in {
sops.secrets.device_json = {
sopsFile = "${secretstore}/hosts/${host}/mullvad/device.json";
device_json.format = "binary";
};
environment.etc."mullvad-vpn/device.conf".source = config.sops.secrets.device_json.path;
}

View File

@@ -1,12 +1,17 @@
{ lib, inputs, outputs, config, pkgs, ... }:
with lib;
let cfg = config.custom.wsl;
{
lib,
inputs,
outputs,
config,
pkgs,
...
}:
with lib; let
cfg = config.custom.wsl;
in {
options.custom.wsl.enable = mkEnableOption "Enable WSL2 settings";
config = mkIf cfg.enable {
# Enable native Docker support
virtualisation.docker.enable = true;
@@ -48,9 +53,5 @@ in {
};
wantedBy = ["sysinit.target"];
};
};
}

View File

@@ -1,6 +1,7 @@
# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file
# This is useful to avoid using channels when using legacy nix commands
let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
let
lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked;
in
import (fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";

View File

@@ -1,6 +1,5 @@
# This file defines overlays
{ inputs, ... }:
{
{inputs, ...}: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs {pkgs = final;};

View File

@@ -1,8 +1,6 @@
# Custom packages, that can be defined similarly to ones from nixpkgs
# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example'
{pkgs ? (import ../nixpkgs.nix) {}}: {
# example = pkgs.callPackage ./example { };
npiperelay = pkgs.callPackage ./npiperelay {};
}

View File

@@ -1,11 +1,13 @@
{ lib, stdenv, fetchurl ,unzip }:
let
{
lib,
stdenv,
fetchurl,
unzip,
}: let
version = "1.6.3";
srcs = {
x86_64-linux = fetchurl {
url =
"https://github.com/jstarks/npiperelay/releases/download/v0.1.0/npiperelay_windows_amd64.zip";
url = "https://github.com/jstarks/npiperelay/releases/download/v0.1.0/npiperelay_windows_amd64.zip";
sha256 = "sha256-a572H/0XwDUHqaPVTYFdzrPa5mmsZ/w79CJdHnZM5fY=";
};
@@ -15,8 +17,8 @@ let
# sha256 = "sha256-zuy4e9bzcRqDeXP6mfzZLCDK/3we25LH6xktnO6HXps=";
# };
};
in stdenv.mkDerivation rec {
in
stdenv.mkDerivation rec {
pname = "npiperelay";
inherit version;
@@ -39,12 +41,10 @@ in stdenv.mkDerivation rec {
'';
meta = with lib; {
description =
"Helper to interface with Windows ssh-agent.exe service from Windows Subsystem for Linux (WSL)";
description = "Helper to interface with Windows ssh-agent.exe service from Windows Subsystem for Linux (WSL)";
# 2019-08-19: The homepage links to old software that doesn't even work --
# it fails to detect ConBee2.
homepage =
"https://github.com/rupor-github/wsl-ssh-agent";
homepage = "https://github.com/rupor-github/wsl-ssh-agent";
license = licenses.free;
platforms = ["x86_64-linux"];
maintainers = with maintainers; [sstent];

View File

@@ -1,23 +1,23 @@
{pkgs ? import <nixpkgs> {}}:
with pkgs;
let nixBin =
writeShellScriptBin "nix" ''
with pkgs; let
nixBin = writeShellScriptBin "nix" ''
${nixFlakes}/bin/nix --option experimental-features "nix-command flakes" "$@"
'';
in mkShell {
in
mkShell {
buildInputs = [
nix home-manager git ssh-to-age sops age
nix
home-manager
git
ssh-to-age
sops
age
];
shellHook = ''
export FLAKE="$(pwd)"
export PATH="$FLAKE/bin:${nixBin}/bin:$PATH"
'';
}
# { pkgs ? (import ./nixpkgs.nix) { } }: {
# default = pkgs.mkShell {
# # Enable experimental features without having to specify the argument
@@ -25,3 +25,4 @@ in mkShell {
# nativeBuildInputs = with pkgs; [ nix home-manager git ssh-to-age sops age ];
# };
# }