attempt to make this work on nixos@Felia

nix-components
pegasust 2022-11-14 20:56:23 +00:00
parent c42d7f45c5
commit 142152e7c0
5 changed files with 116 additions and 88 deletions

View File

@ -31,78 +31,82 @@
pkgs = import nixpkgs { inherit system overlays; };
lib = (import ../lib-nix { inherit pkgs from-yaml; lib = pkgs.lib; });
in
rec {
homeConfigurations.nyx = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "nyx";
homeDirectory = "/home/nyx";
{
homeConfigurations =
let x11_wsl = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
in
rec {
"hungtr" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "hungtr";
homeDirectory = "/home/hungtr";
};
};
};
};
};
homeConfigurations.nixos = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "nixos";
homeDirectory = "/home/nixos";
shellInitExtra = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
"nixos@Felia" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
# optionally pass inarguments to module
# we migrate this from in-place modules to allow flexibility
# in this case, we can add "home" to input arglist of home.nix
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "nixos";
homeDirectory = "/home/nixos";
};
};
};
};
};
homeConfigurations.ubuntu_admin = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "ubuntu_admin";
homeDirectory = "/home/ubuntu_admin";
shellInitExtra = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
"ubuntu_admin" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "ubuntu_admin";
homeDirectory = "/home/ubuntu_admin";
shellInitExtra = ''
# x11 output for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
};
};
};
};
};
homeConfigurations.hwtr = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "hwtr";
homeDirectory = "/home/hwtr";
packages = [ pkgs.nixgl.nixGLIntel ];
shellAliases = {
nixGL = "nixGLIntel";
hwtr = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
];
extraSpecialArgs = {
myLib = lib;
myHome = {
username = "hwtr";
homeDirectory = "/home/hwtr";
packages = [ pkgs.nixgl.nixGLIntel ];
shellAliases = {
nixGL = "nixGLIntel";
};
};
};
};
};
};
};
}

View File

@ -1,10 +1,14 @@
{ lib, pkgs, config, modulesPath, ... }:
{ lib, pkgs, config, modulesPath, specialArgs, ... }:
let hostname = specialArgs.hostname;
enableSSH = specialArgs.enableSSH or true;
in
with lib;
{
imports = [
/etc/nixos/hardware-configuration.nix
./profiles/${hostname}/hardware-configuration.nix
"${modulesPath}/profiles/minimal.nix"
];
networking.hostName = hostname;
system.stateVersion = "22.05";
# users.users.<defaultUser>.uid = 1000;
@ -15,19 +19,19 @@ with lib;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
users.users.hungtr = {
isNormalUser = true;
home = "/home/hungtr";
description = "pegasust/hungtr";
extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile ../ssh/authorized_keys);
};
# users.users.hungtr = {
# isNormalUser = true;
# home = "/home/hungtr";
# description = "pegasust/hungtr";
# extraGroups = [ "wheel" "networkmanager" ];
# openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile ../ssh/authorized_keys);
# };
# Let's just open ssh server in general, even though it may not be
# network-accessible
services.openssh = {
permitRootLogin = "no";
enable = true;
enable = enableSSH;
};
# Some basic programs

View File

@ -6,17 +6,44 @@
};
outputs = { self, nixpkgs, ... }: {
# Windows with NixOS WSL
nixosConfigurations.Felia = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./wsl-configuration.nix
];
specialArgs = {
hostname = "Felia";
enableSSH = false;
};
};
# Generic machine
nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
specialArgs = {
hostname = "lizzi";
};
};
nixosConfigurations.nyx = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
specialArgs = {
hostname = "nyx";
};
};
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
];
specialArgs = {
hostname = "nixos";
};
};
};
}

View File

@ -17,12 +17,6 @@
fsType = "ext4";
};
fileSystems."/mnt/wsl" =
{
device = "tmpfs";
fsType = "tmpfs";
};
fileSystems."/mnt/wsl/docker-desktop/shared-sockets/guest-services" =
{
device = "none";

View File

@ -1,4 +1,4 @@
{ lib, pkgs, config, modulesPath, ... }:
{ lib, ... }:
with lib;
let
@ -6,9 +6,8 @@ let
in
{
imports = [
/etc/nixos/hardware-configuration.nix
nixos-wsl.nixosModules.wsl
./configuration.nix
nixos-wsl.nixosModules.wsl
];
wsl = {
@ -16,7 +15,7 @@ in
automountPath = "/mnt";
defaultUser = "nixos"; # if change defaultUser, make sure uid to be 1000 (first user)
startMenuLaunchers = true;
automountOptions = "drvfs,metadata,uid=1000,gid=100";
# automountOptions = "drvfs,metadata,uid=1000,gid=100";
# Enable native Docker support
# docker-native.enable = true;