get it working on nixos

This commit is contained in:
Patrick Neff 2024-04-08 19:08:34 +02:00
parent badd0d1b97
commit 68b3035533
23 changed files with 236 additions and 152 deletions

View File

@ -18,7 +18,7 @@
},
"devshell": {
"inputs": {
"flake-utils": "flake-utils_4",
"flake-utils": "flake-utils_5",
"nixpkgs": [
"nixvim",
"nixpkgs"
@ -55,6 +55,22 @@
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_3": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
@ -68,7 +84,7 @@
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-compat_3": {
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -222,6 +238,24 @@
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
@ -236,9 +270,9 @@
"type": "github"
}
},
"flake-utils_5": {
"flake-utils_6": {
"inputs": {
"systems": "systems_3"
"systems": "systems_4"
},
"locked": {
"lastModified": 1710146030,
@ -449,6 +483,28 @@
"type": "github"
}
},
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1710519878,
"narHash": "sha256-0dbc10OBFUVYyXC+C+N6vRUd8xyBSRxkcZ4Egipbx0M=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "aef95bdb6800a3a2af7aa7083d6df03067da6592",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NixOS-WSL",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1712439257,
@ -501,7 +557,7 @@
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_2",
"flake-compat": "flake-compat_3",
"flake-parts": "flake-parts_4",
"home-manager": "home-manager_2",
"nix-darwin": "nix-darwin",
@ -541,8 +597,8 @@
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_3",
"flake-utils": "flake-utils_5",
"flake-compat": "flake-compat_4",
"flake-utils": "flake-utils_6",
"gitignore": "gitignore",
"nixpkgs": [
"nixvim",
@ -575,10 +631,11 @@
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nix-colors": "nix-colors",
"nixgl": "nixgl",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"nur": "nur",
"systems": "systems_4"
"systems": "systems_5"
}
},
"systems": {
@ -640,6 +697,21 @@
"repo": "default",
"type": "github"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -40,18 +40,18 @@
wsl = import ./modules/nixos/wsl;
};
nixosConfigurations =
flakeLib.mkSystem {
inherit inputs nixpkgs vars;
flakeLib.mkNixosConfiguration {
inherit inputs nixpkgs outputs vars flakeLib overlays;
system = "x86_64-linux";
hostName = "vm";
}
// flakeLib.mkSystem {
inherit inputs nixpkgs vars;
// flakeLib.mkNixosConfiguration {
inherit inputs nixpkgs outputs vars flakeLib overlays;
system = "x86_64-linux";
hostName = "wsl-dev";
}
// flakeLib.mkSystem {
inherit inputs nixpkgs vars;
// flakeLib.mkNixosConfiguration {
inherit inputs outputs nixpkgs vars flakeLib overlays;
system = "aarch64-linux";
hostName = "pi1";
}
@ -64,7 +64,7 @@
};
homeConfigurations = {
"odie@wanaheim" = flakeLib.mkHomeConfiguration {
inherit inputs outputs nixpkgs flakeLib vars;
inherit inputs outputs nixpkgs flakeLib vars overlays;
profile = ./profiles/home-manager/desktop-dev.nix;
system = "x86_64-linux";
modules = [
@ -83,7 +83,7 @@
];
};
"odie@asgard" = flakeLib.mkHomeConfiguration {
inherit inputs outputs nixpkgs flakeLib vars;
inherit inputs outputs nixpkgs flakeLib vars overlays;
profile = ./profiles/home-manager/desktop-dev.nix;
system = "x86_64-linux";
modules = [
@ -141,5 +141,9 @@
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}

View File

@ -1,6 +1,27 @@
{outputs, ...}: {
{
inputs,
outputs,
flakeLib,
vars,
...
}: {
imports = [
./hardware-configuration.nix
outputs.nixosModules.base
../../modules/nixos/base
];
networking = {
inherit (vars) hostName domain;
};
home-manager = flakeLib.mkHomeNixosModule {
inherit inputs outputs vars flakeLib;
modules = [
../../modules/home-manager/base.nix
../../modules/home-manager/shell.nix
{
services.picom.enable = false;
}
];
};
}

View File

@ -1,53 +1,29 @@
{
nixpkgs,
vars,
outputs,
inputs,
flakeLib,
system,
profile,
modules ? [],
...
}: {
imports = [
inputs.home-manager.nixosModules.home-manager
./hardware-configuration.nix
inputs.home-manager.nixosModules.default
outputs.nixosModules.base
outputs.nixosModules.wsl
outputs.nixosModules.desktop
../../modules/nixos/base
../../modules/nixos/desktop
../../modules/nixos/wsl
];
networking = {
inherit (vars) hostName domain;
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
user.${vars.userName} = {
imports = [
outputs.homeManagerModules.base
outputs.homeManagerModules.shell
outputs.homeManagerModules.dev
outputs.homeManagerModules.desktop
];
};
extraSpecialArgs = {
home-manager = flakeLib.mkHomeNixosModule {
inherit inputs outputs vars flakeLib;
inherit (inputs) nix-colors;
};
};
boot.loader.systemd-boot.enable = true;
desktop.enable = true;
desktop.awesome.enable = true;
services = {
openssh.enable = true;
qemuGuest.enable = true;
spice-vdagentd.enable = true;
spice-autorandr.enable = true;
modules = [
../../modules/home-manager/base.nix
../../modules/home-manager/desktop.nix
../../modules/home-manager/dev.nix
../../modules/home-manager/shell.nix
{
services.picom.enable = false;
}
];
};
system.stateVersion = "23.11";

View File

@ -1,7 +1,13 @@
{outputs, vars, ...}: {
{
inputs,
outputs,
vars,
flakeLib,
...
}: {
imports = [
outputs.nixosModules.base
outputs.nixosModules.wsl
../../modules/nixos/base
../../modules/nixos/wsl
];
wsl.enable = true;
@ -10,5 +16,17 @@
inherit (vars) hostName domain;
};
home-manager = flakeLib.mkHomeNixosModule {
inherit inputs outputs vars flakeLib;
modules = [
../../modules/home-manager/base.nix
../../modules/home-manager/dev.nix
../../modules/home-manager/shell.nix
{
services.picom.enable = false;
}
];
};
system.stateVersion = "23.11";
}

View File

@ -3,6 +3,7 @@
mkNixVim = import ./mkNixVim.nix;
mkNixVimLib = import ./mkNixVimLib.nix;
mkNixVimModule = import ./mkNixVimModule.nix;
mkSystem = import ./mkSystem.nix;
mkNixosConfiguration = import ./mkNixosConfiguration.nix;
mkHomeConfiguration = import ./mkHomeConfiguration.nix;
mkHomeNixosModule = import ./mkHomeNixosModule.nix;
}

18
lib/mkHomeNixosModule.nix Normal file
View File

@ -0,0 +1,18 @@
{
inputs,
outputs,
vars,
flakeLib,
modules ? [],
...
}: {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
inherit inputs outputs vars flakeLib;
inherit (inputs) nix-colors;
};
users.${vars.username} = {
imports = modules;
};
}

View File

@ -1,5 +1,8 @@
{
inputs,
outputs,
flakeLib,
overlays,
system,
hostName,
nixpkgs,
@ -9,7 +12,7 @@
${hostName} = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit inputs outputs flakeLib overlays;
vars =
vars
// {

View File

@ -21,62 +21,12 @@ lib.mkIf config.desktop.awesome.enable {
target = ".config/awesome/theme.lua";
text = import ./config/theme.nix args;
};
xinitrc = {
target = ".xinitrc";
text = ''
#!/bin/sh
userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap
# merge in defaults and keymaps
if [ -f $sysresources ]; then
xrdb -merge $sysresources
fi
if [ -f $sysmodmap ]; then
xmodmap $sysmodmap
fi
if [ -f "$userresources" ]; then
xrdb -merge "$userresources"
fi
if [ -f "$usermodmap" ]; then
xmodmap "$usermodmap"
fi
darkman dark
${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1 &
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
eval $(dbus-launch --exit-with-session --sh-syntax)
fi
systemctl --user import-environment DISPLAY XAUTHORITY
if command -v dbus-update-activation-environment >/dev/null 2>&1; then
dbus-update-activation-environment DISPLAY XAUTHORITY
fi
exec awesome --search ${pkgs.luaPackages.vicious}/lib/lua/5.2
'';
executable = true;
};
};
};
xsession = {
enable = true;
command = "awesome";
windowManager.awesome = {
package = pkgs.awesome.override {
lua = pkgs.luajit;
};
enable = true;
luaModules = with pkgs.luaPackages; [
luarocks

View File

@ -40,6 +40,7 @@
./theme
./awesome
./rofi
./network-manager-applet
];
config = lib.mkIf config.desktop.enable {
desktop.awesome.enable = lib.mkDefault true;

View File

@ -0,0 +1,10 @@
{
lib,
config,
...
}:
lib.mkIf config.desktop.enable {
services = {
network-manager-applet.enable = true;
};
}

View File

@ -5,7 +5,7 @@
glxBackend = lib.mkOption {
type = lib.types.str;
description = "the default terminal to use";
default = "glx";
default = "xrender";
};
};
};

View File

@ -1,4 +1,4 @@
_: {
{lib,...}: {
imports = [
./bootloader
./user
@ -11,6 +11,8 @@ _: {
];
config = {
hardware.enableRedistributableFirmware = true;
hardware.enableRedistributableFirmware = lib.mkDefault true;
services.openssh.enable = lib.mkDefault true;
boot.loader.systemd-boot.enable = lib.mkDefault true;
};
}

View File

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

View File

@ -1,10 +1,14 @@
_: {
{overlays, ...}: {
nixpkgs = {
config.allowUnfree = true;
inherit overlays;
};
nix = {
optimise = {
automatic = true;
};
settings = {
experimental-features = [ "nix-command" "flakes" ];
experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true;
};
gc = {

View File

@ -3,6 +3,7 @@
./fonts
./sound
./xorg
./network-manager
];
options = {
@ -10,7 +11,8 @@
};
config = {
programs.dconf.enable = true;
hardware.opengl.enable = true;
programs.dconf.enable = lib.mkDefault true;
hardware.opengl.enable = lib.mkDefault true;
desktop.enable = lib.mkDefault true;
};
}

View File

@ -1,4 +1,4 @@
{
{lib, config, ...}: lib.mkIf config.desktop.enable {
networking.networkmanager = {
enable = true;
};

View File

@ -1,4 +1,10 @@
{ lib, config, vars, ... }: {
{
lib,
config,
vars,
pkgs,
...
}: {
imports = [
./i18n.nix
];
@ -7,16 +13,20 @@
services.xserver = lib.mkIf config.desktop.enable {
enable = true;
displayManager = {
sddm.enable = true;
autoLogin = {
user = vars.username;
enable = true;
};
lightdm = {
enable = true;
greeters.gtk.enable = true;
};
defaultSession = "none+awesome";
};
windowManager.awesome = {
enable = true;
luaModules = with pkgs.luaPackages; [
luarocks
vicious
];
};
libinput = {
enable = true;

View File

@ -0,0 +1,7 @@
{
services = {
qemuGuest.enable = true;
spice-vdagentd.enable = true;
spice-autorandr.enable = true;
};
}

View File

@ -1,6 +1,5 @@
{
inputs,
outputs,
pkgs,
extraSpecialArgs,
modules ? [],
@ -10,10 +9,10 @@ inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs extraSpecialArgs;
modules =
[
outputs.homeManagerModules.base
outputs.homeManagerModules.shell
outputs.homeManagerModules.desktop
outputs.homeManagerModules.dev
../../modules/home-manager/base.nix
../../modules/home-manager/shell.nix
../../modules/home-manager/desktop.nix
../../modules/home-manager/dev.nix
]
++ modules;
}

View File

@ -1,6 +1,5 @@
{
inputs,
outputs,
pkgs,
extraSpecialArgs,
modules ? [],
@ -10,9 +9,9 @@ inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs extraSpecialArgs;
modules =
[
outputs.homeManagerModules.base
outputs.homeManagerModules.shell
outputs.homeManagerModules.desktop
../../modules/home-manager/base.nix
../../modules/home-manager/shell.nix
../../modules/home-manager/desktop.nix
]
++ modules;
}

View File

@ -1,6 +1,5 @@
{
inputs,
outputs,
pkgs,
extraSpecialArgs,
modules ? [],
@ -10,9 +9,9 @@ inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs extraSpecialArgs;
modules =
[
outputs.homeManagerModules.base
outputs.homeManagerModules.shell
outputs.homeManagerModules.dev
../../modules/home-manager/base.nix
../../modules/home-manager/shell.nix
../../modules/home-manager/dev.nix
]
++ modules;
}

View File

@ -1,6 +1,5 @@
{
inputs,
outputs,
pkgs,
extraSpecialArgs,
modules ? [],
@ -10,8 +9,8 @@ inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs extraSpecialArgs;
modules =
[
outputs.homeManagerModules.base
outputs.homeManagerModules.shell
../../modules/home-manager/base.nix
../../modules/home-manager/shell.nix
]
++ modules;
}