fixing fitbit

This commit is contained in:
2023-11-29 21:08:18 +00:00
parent 44e26348db
commit 0b8ddd6ffb
35 changed files with 45 additions and 765 deletions

View File

@@ -8,6 +8,10 @@
imports = [
../common.nix
../user-sstent.nix
../wsl.nix
../syncthing.nix
../mnt_public.nix
../vpn.nix
inputs.nixos-wsl.nixosModules.wsl
];

View File

@@ -12,27 +12,6 @@
inputs.sops-nix.nixosModules.sops
];
###dotfiles path variable
options._dotfiles = lib.mkOption {
type = lib.types.str;
default = "${inputs.self}/home-manager/dotfiles";
description = "Path to the dotfiles in this repository";
};
###secrets path variable
options._secrets = lib.mkOption {
type = lib.types.str;
default = "/run/user/1000/secrets";
description = "Path to the Secrets runtime";
};
###secretstore path variable
options._secretstore = lib.mkOption {
type = lib.types.str;
default = "${inputs.self}/secrets";
description = "Path to the Secrets storage";
};
config = {
system.stateVersion = "23.05";
@@ -41,18 +20,10 @@
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
};
home-manager = {
useUserPackages = true;
#extraSpecialArgs = {inherit inputs outputs;};
sharedModules = [
inputs.sops-nix.homeManagerModules.sops
];
};
nixpkgs.config.allowUnfree = true;
programs.fuse.userAllowOther = true;
security.sudo.wheelNeedsPassword = false;
virtualisation.docker.enable = true;
virtualisation.docker.enable = true;
# nixpkgs.overlays = overlays;
# Enable nix flakes
@@ -64,6 +35,12 @@
# nix.nixPath = [ "nixpkgs=pkgs.outPath" ];
networking.search = ["node.dc1.consul" "service.dc1.consul"];
##VSCode
services.vscode-server.enable = true;
services.vscode-server.enableFHS = true;
services.vscode-server.nodejsPackage = pkgs.nodejs-18_x;
#services.envfs.enable = true;
environment.systemPackages = [
pkgs.git

View File

@@ -1,44 +0,0 @@
{ system, self, nixpkgs, inputs, ... }:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true; # Allow proprietary software
};
lib = nixpkgs.lib;
in
{
StuPC-WSL = lib.nixosSystem {
# Laptop profile
inherit system;
specialArgs = { inherit inputs; };
modules = [
#../home-manager #hyprland and sway,go to this dir,choose one
] ++ [
./common.nix
] ++ [
inputs.home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# extraSpecialArgs = { inherit user; };
users.sstent = {
imports = [
(import ../home-manager)
] ++ [
];
};
};
nixpkgs = {
overlays =
[
self.overlays.default
];
};
}
];
};
}

View File

@@ -8,6 +8,10 @@
imports = [
../common.nix
../user-sstent.nix
../wsl.nix
../syncthing.nix
../mnt_public.nix
../vpn.nix
inputs.nixos-wsl.nixosModules.wsl
];

16
hosts/mnt_public.nix Normal file
View File

@@ -0,0 +1,16 @@
{
lib,
inputs,
outputs,
config,
...
}:{
fileSystems."/mnt/Public" = {
device = "//192.168.1.109/Public";
fsType = "cifs";
# options = ["uid=0,gid=1000"];
options = ["guest" "uid=1000"];
};
}

16
hosts/ssh.nix Normal file
View File

@@ -0,0 +1,16 @@
{
lib,
pkgs,
config,
...
}:{
#define option to enable this
services.openssh = {
enable = true;
permitRootLogin = "no";
passwordAuthentication = false;
};
networking.firewall.allowedTCPPorts = [22];
}

32
hosts/syncthing.nix Normal file
View File

@@ -0,0 +1,32 @@
{
lib,
inputs,
outputs,
config,
...
}:
{
services.syncthing = {
enable = true;
dataDir = "/home/sstent";
openDefaultPorts = true;
configDir = "/home/sstent/.config/syncthing";
user = "sstent";
group = "users";
guiAddress = "0.0.0.0:8385";
overrideDevices = true;
overrideFolders = true;
devices = {
"StuPC" = {id = "Z43MPGF-OKG6K34-WTTFUDO-UG6E3TE-YCLSOAT-5LN5KMW-QHL2VSK-EZCGCAP";};
"go3" = {id = "YDOL433-AHAL33M-NWLLDDQ-2D36ZIE-YNZVTKE-25TRBZ2-JXRSN7Y-Z5EOVQN";};
};
folders = {
"default" = {
path = "/home/sstent/sync";
devices = ["StuPC" "go3"];
};
};
};
}

38
hosts/vpn.nix Normal file
View File

@@ -0,0 +1,38 @@
{
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 {};
in {
#define option to enable this
options.custom.mullvad.enable = mkEnableOption "Enable SSH";
# imports = [ secret ];
config = mkIf cfg.enable {
networking.wireguard.enable = true;
services.mullvad-vpn.enable = true;
# set some options after every daemon start
# to avoid accidentally leaving unsafe settings
systemd.services."mullvad-daemon" = {
postStart = ''
while ! ${pkgs.mullvad}/bin/mullvad status >/dev/null; do sleep 1; done
${pkgs.mullvad}/bin/mullvad lan set allow #enable local lan access
${pkgs.mullvad}/bin/mullvad relay set tunnel-protocol wireguard
${pkgs.mullvad}/bin/mullvad relay set location ca mtr
'';
};
};
}

52
hosts/wsl.nix Normal file
View File

@@ -0,0 +1,52 @@
{
lib,
inputs,
outputs,
config,
pkgs,
...
}:
{
# Enable native Docker support
virtualisation.docker.enable = true;
wsl = {
enable = true;
wslConf.automount.root = "/mnt";
defaultUser = "sstent";
startMenuLaunchers = true;
wslConf.interop.appendWindowsPath = false;
#No longer needed in 23.05
#interop.preserveArgvZero = true;
# docker-native.enable = true;
nativeSystemd = true;
# Enable integration with Docker Desktop (needs to be installed)
# docker-desktop.enable = true;
};
systemd.services.nixs-wsl-systemd-fix = {
description = "Fix the /dev/shm symlink to be a mount";
unitConfig = {
DefaultDependencies = "no";
Before = [
"sysinit.target"
"systemd-tmpfiles-setup-dev.service"
"systemd-tmpfiles-setup.service"
"systemd-sysctl.service"
];
ConditionPathExists = "/dev/shm";
ConditionPathIsSymbolicLink = "/dev/shm";
ConditionPathIsMountPoint = "/run/shm";
};
serviceConfig = {
Type = "oneshot";
ExecStart = [
"${pkgs.coreutils-full}/bin/rm /dev/shm"
"/run/wrappers/bin/mount --bind -o X-mount.mkdir /run/shm /dev/shm"
];
};
wantedBy = ["sysinit.target"];
};
}