Initial commit

This commit is contained in:
Patrick Neff 2024-03-09 15:41:01 +01:00
commit 7c07902392
12 changed files with 1341 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.tar.gz

1188
flake.lock Normal file

File diff suppressed because it is too large Load Diff

42
flake.nix Normal file
View File

@ -0,0 +1,42 @@
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixos-wsl.url = "github:nix-community/NixOS-WSL";
home-manager.url = "github:nix-community/home-manager";
home-manager-flake.url = "git+ssh://gitea@pi1.odie.intranet/odie/home-manager-flake.git";
neovim-flake.url = "git+ssh://gitea@pi1.odie.intranet/odie/neovim-flake.git";
};
outputs = inputs@{ self, nixpkgs, flake-utils, nixos-wsl, home-manager, ... }:
let
vars = rec {
name = "Patrick Neff";
username = "odie";
homeDirectory = "/home/${username}";
locale = "de_DE.UTF-8";
email = "odie86@gmail.com";
timeZone = "Europe/Berlin";
};
mkSystem = system: hostName: {
${hostName} =
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
vars = vars // {
inherit hostName;
};
};
modules = [
./hosts/${hostName}
];
};
};
in
{
nixosConfigurations = mkSystem "x86_64-linux" "wsl-dev" // { };
};
}

19
hosts/wsl-dev/default.nix Normal file
View File

@ -0,0 +1,19 @@
{ vars, inputs, ... }:
{
imports = [
../../modules
../../modules/wsl
];
home-manager.users.odie = _: {
imports = [
inputs.home-manager-flake.homeModules.base
inputs.home-manager-flake.homeModules.shell
inputs.neovim-flake.homeModules.default
];
programs.neovim-ide.enable = true;
};
system.stateVersion = "23.11";
}

10
modules/default.nix Normal file
View File

@ -0,0 +1,10 @@
_: {
imports = [
./user
./network
./i18n
./nixos
./programs
./home-manager
];
}

View File

@ -0,0 +1,11 @@
{ inputs, vars, ... }: {
imports = [
inputs.home-manager.nixosModules.home-manager
];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit vars; };
};
}

8
modules/i18n/default.nix Normal file
View File

@ -0,0 +1,8 @@
{ config, lib, pkgs, vars, ... }:
let
inherit (vars) locale timeZone;
in
{
i18n.defaultLocale = locale;
time.timeZone = timeZone;
}

View File

@ -0,0 +1,7 @@
{ config, lib, pkgs, vars, ... }:
let
inherit (vars) hostName;
in
{
networking.hostName = hostName;
}

View File

@ -0,0 +1,3 @@
_: {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View File

@ -0,0 +1,13 @@
{ config, lib, pkgs, vars, ... }:
{
environment.systemPackages = with pkgs; [
vim
git
openssh
];
programs = {
zsh.enable = true;
command-not-found.enable = false;
};
}

22
modules/user/default.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, lib, pkgs, vars, ... }:
let
inherit (vars) username name locale hostname;
in
{
users = {
defaultUserShell = pkgs.zsh;
groups.odie = { };
users = {
${username} = {
name = username;
uid = 1000;
isNormalUser = true;
home = "/home/${username}";
description = name;
extraGroups = [ "wheel" ];
packages = with pkgs; [ wslu wsl-open home-manager ];
};
};
};
}

17
modules/wsl/default.nix Normal file
View File

@ -0,0 +1,17 @@
{ config, lib, pkgs, vars, inputs, ... }:
let
inherit (vars) username hostName;
in
{
imports = [
inputs.nixos-wsl.nixosModules.wsl
];
wsl = {
enable = true;
defaultUser = username;
nativeSystemd = true;
useWindowsDriver = true;
wslConf = { network.hostname = hostName; };
};
}