Add LSP and formatter
This commit is contained in:
parent
8998c1078b
commit
c3cc521997
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
// Nix settings
|
||||
"nix.formatterPath": [
|
||||
"nixpkgs-fmt",
|
||||
"nixfmt",
|
||||
"treefmt",
|
||||
"--stdin",
|
||||
"{file}",
|
||||
"nix",
|
||||
"fmt",
|
||||
"--",
|
||||
"-",
|
||||
],
|
||||
"nix.enableLanguageServer": true,
|
||||
"nix.serverPath": "nixd",
|
||||
"nix.serverSettings": {
|
||||
"nixd": {
|
||||
"nixpkgs": {
|
||||
"expr": "(builtins.getFlake \"${workspaceFolder}/flake.nix\").inputs.nixpkgs { }"
|
||||
},
|
||||
"formatting": {
|
||||
"command": [
|
||||
"nix fmt"
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"nixos": {
|
||||
"expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixos.options"
|
||||
},
|
||||
"live": {
|
||||
"expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.live.options"
|
||||
},
|
||||
"nixosvm": {
|
||||
"expr": "(builtins.getFlake (builtins.toString ./.)).nixosConfigurations.nixosvm.options"
|
||||
},
|
||||
// "home-manager": {
|
||||
// "expr": "(builtins.getFlake \"/absolute/path/to/flake\").homeConfigurations.<name>.options"
|
||||
// },
|
||||
}
|
||||
}
|
||||
},
|
||||
"nixEnvSelector.useFlakes": true,
|
||||
"nixEnvSelector.suggestion": true,
|
||||
"nixEnvSelector.nixFile": "${workspaceFolder}/flake.nix",
|
||||
}
|
||||
104
flake.nix
104
flake.nix
|
|
@ -18,53 +18,69 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, install-system, ... } @ inputs: let
|
||||
system = "x86_64-linux";
|
||||
host = "vm";
|
||||
profile = "vm";
|
||||
username = "josh";
|
||||
in {
|
||||
nixosConfigurations = {
|
||||
nixos = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit host;
|
||||
inherit profile;
|
||||
inherit username;
|
||||
outputs =
|
||||
{
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
install-system,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
host = "vm";
|
||||
profile = "vm";
|
||||
username = "josh";
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
nixos = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit host;
|
||||
inherit profile;
|
||||
inherit username;
|
||||
};
|
||||
modules = [
|
||||
./hosts/${host}
|
||||
];
|
||||
};
|
||||
modules = [
|
||||
./hosts/${host}
|
||||
|
||||
live = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit host;
|
||||
inherit profile;
|
||||
inherit username;
|
||||
};
|
||||
modules = [
|
||||
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
|
||||
{ environment.systemPackages = [ install-system.packages.${system}.default ]; }
|
||||
./hosts/${host}
|
||||
];
|
||||
};
|
||||
|
||||
nixosvm = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit host;
|
||||
inherit profile;
|
||||
inherit username;
|
||||
};
|
||||
modules = [
|
||||
./hosts/${host}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
devShell.${system} = nixpkgs.legacyPackages.${system}.pkgs.mkShell {
|
||||
packages = with nixpkgs.legacyPackages.${system}.pkgs; [
|
||||
nixd
|
||||
];
|
||||
};
|
||||
|
||||
live = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit host;
|
||||
inherit profile;
|
||||
inherit username;
|
||||
};
|
||||
modules = [
|
||||
(nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
|
||||
{ environment.systemPackages = [ install-system.packages.${system}.default ]; }
|
||||
./hosts/${host}
|
||||
];
|
||||
};
|
||||
|
||||
nixosvm = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
inherit host;
|
||||
inherit profile;
|
||||
inherit username;
|
||||
};
|
||||
modules = [
|
||||
./hosts/${host}
|
||||
];
|
||||
};
|
||||
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -14,8 +14,13 @@ in
|
|||
};
|
||||
|
||||
# Add wayland screensharing support if PipeWire is enabled
|
||||
environment.systemPackages = with pkgs; []
|
||||
++ (if pipewireCfg.enable
|
||||
then [ (wrapFirefox (firefox-unwrapped.override { pipewireSupport = true; }) {}) ]
|
||||
else [ firefox ]);
|
||||
environment.systemPackages =
|
||||
with pkgs;
|
||||
[ ]
|
||||
++ (
|
||||
if pipewireCfg.enable then
|
||||
[ (wrapFirefox (firefox-unwrapped.override { pipewireSupport = true; }) { }) ]
|
||||
else
|
||||
[ firefox ]
|
||||
);
|
||||
}
|
||||
|
|
@ -6,13 +6,14 @@
|
|||
{
|
||||
fonts = {
|
||||
fontconfig.enable = true;
|
||||
packages = with pkgs; [
|
||||
font-awesome
|
||||
montserrat
|
||||
nerd-fonts.jetbrains-mono
|
||||
noto-fonts-emoji
|
||||
] ++ (if config.modules.zsh.enable
|
||||
then [ nerd-fonts.meslo-lg ]
|
||||
else []);
|
||||
packages =
|
||||
with pkgs;
|
||||
[
|
||||
font-awesome
|
||||
montserrat
|
||||
nerd-fonts.jetbrains-mono
|
||||
noto-fonts-emoji
|
||||
]
|
||||
++ (if config.modules.zsh.enable then [ nerd-fonts.meslo-lg ] else [ ]);
|
||||
};
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
config,
|
||||
host,
|
||||
pkgs,
|
||||
...
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
fonts = {
|
||||
emoji = {
|
||||
package = pkgs.noto-fonts-emoji;
|
||||
package = pkgs.noto-fonts-emoji;
|
||||
name = "Noto Color Emoji";
|
||||
};
|
||||
monospace = {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.system;
|
||||
cfg = config.system;
|
||||
in
|
||||
{
|
||||
nix = {
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@
|
|||
config,
|
||||
host,
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
profile,
|
||||
username,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
shellCfg = config.modules.shell;
|
||||
in
|
||||
|
|
@ -18,7 +16,14 @@ in
|
|||
useUserPackages = true;
|
||||
useGlobalPkgs = false;
|
||||
backupFileExtension = "backup";
|
||||
extraSpecialArgs = { inherit host inputs profile username; };
|
||||
extraSpecialArgs = {
|
||||
inherit
|
||||
host
|
||||
inputs
|
||||
profile
|
||||
username
|
||||
;
|
||||
};
|
||||
users.${username} = {
|
||||
imports = [ ./../home ];
|
||||
home = {
|
||||
|
|
@ -42,7 +47,7 @@ in
|
|||
};
|
||||
|
||||
# Set /etc/shells so GDM will show our user when ZSH is selected
|
||||
environment.shells = with pkgs; [ pkgs.${shellCfg.defaultShell} ];
|
||||
environment.shells = [ pkgs.${shellCfg.defaultShell} ];
|
||||
|
||||
nix.settings.allowed-users = [ "${username}" ];
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
host,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
{
|
||||
lib,
|
||||
osConfig,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = osConfig.modules.hyprland;
|
||||
in
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
host,
|
||||
lib,
|
||||
osConfig,
|
||||
pkgs,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
pkgs,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
{
|
||||
lib,
|
||||
osConfig,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
hyprlandCfg = osConfig.modules.hyprland;
|
||||
pipewireCfg = osConfig.modules.pipewire;
|
||||
|
|
@ -17,27 +15,31 @@ in
|
|||
mimeApps.enable = true;
|
||||
portal = {
|
||||
enable = true;
|
||||
extraPortals = []
|
||||
++ (if hyprlandCfg.enable
|
||||
then [ pkgs.xdg-desktop-portal-hyprland ]
|
||||
else [])
|
||||
++ (if pipewireCfg.enable
|
||||
then [
|
||||
pkgs.xdg-desktop-portal-wlr
|
||||
pkgs.xdg-desktop-portal-gtk
|
||||
]
|
||||
else [])
|
||||
++ (if plasmaCfg.enable
|
||||
then [ pkgs.kdePackages.xdg-desktop-portal-kde ]
|
||||
else []);
|
||||
configPackages = []
|
||||
++ (if hyprlandCfg.enable
|
||||
then [ pkgs.hyprland ]
|
||||
else [])
|
||||
++ (if plasmaCfg.enable
|
||||
# TODO: use the correct packages or config
|
||||
then [ pkgs.kdePackages.kde-gtk-config ]
|
||||
else []);
|
||||
extraPortals =
|
||||
[ ]
|
||||
++ (if hyprlandCfg.enable then [ pkgs.xdg-desktop-portal-hyprland ] else [ ])
|
||||
++ (
|
||||
if pipewireCfg.enable then
|
||||
[
|
||||
pkgs.xdg-desktop-portal-wlr
|
||||
pkgs.xdg-desktop-portal-gtk
|
||||
]
|
||||
else
|
||||
[ ]
|
||||
)
|
||||
++ (if plasmaCfg.enable then [ pkgs.kdePackages.xdg-desktop-portal-kde ] else [ ]);
|
||||
configPackages =
|
||||
[ ]
|
||||
++ (if hyprlandCfg.enable then [ pkgs.hyprland ] else [ ])
|
||||
++ (
|
||||
if
|
||||
plasmaCfg.enable
|
||||
# TODO: use the correct packages or config
|
||||
then
|
||||
[ pkgs.kdePackages.kde-gtk-config ]
|
||||
else
|
||||
[ ]
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
pkgs,
|
||||
profile,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = osConfig.modules.zsh;
|
||||
xdgCfg = config.xdg;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
config,
|
||||
lib,
|
||||
osConfig,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.displayManager;
|
||||
in
|
||||
{
|
||||
options.modules.displayManager = {
|
||||
displayManager = mkOption {
|
||||
|
|
|
|||
|
|
@ -1,16 +1,12 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.hyprland;
|
||||
in
|
||||
{
|
||||
options.modules.hyprland = {
|
||||
enable = mkEnableOption {
|
||||
default = false;
|
||||
default = false;
|
||||
description = "Enable Hyprland";
|
||||
};
|
||||
terminal = mkOption {
|
||||
|
|
@ -26,7 +22,7 @@ in
|
|||
monitor = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ",preferred,auto,1" ];
|
||||
description = ''
|
||||
description = ''
|
||||
Monitors to use for Hyprland.
|
||||
'';
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.pipewire;
|
||||
in
|
||||
{
|
||||
options.modules.pipewire = {
|
||||
enable = mkEnableOption {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.plasma;
|
||||
in
|
||||
{
|
||||
options.modules.plasma = {
|
||||
enable = mkEnableOption {
|
||||
|
|
|
|||
|
|
@ -22,11 +22,17 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config.assertions = []
|
||||
++ (if cfg.defaultShell == "zsh"
|
||||
then [{
|
||||
config.assertions =
|
||||
[ ]
|
||||
++ (
|
||||
if cfg.defaultShell == "zsh" then
|
||||
[
|
||||
{
|
||||
assertion = zshCfg.enable;
|
||||
message = "You have selected zsh as the default shell, but you haven't enabled it in your configuration.\n\nPlease enable it by adding `modules.zsh.enable = true`.";
|
||||
}]
|
||||
else []);
|
||||
}
|
||||
]
|
||||
else
|
||||
[ ]
|
||||
);
|
||||
}
|
||||
|
|
@ -1,20 +1,16 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.system;
|
||||
in
|
||||
{
|
||||
options.system = {
|
||||
locale = mkOption {
|
||||
type = types.str;
|
||||
type = types.str;
|
||||
default = "en_US.UTF-8";
|
||||
};
|
||||
|
||||
keyMap = mkOption {
|
||||
keyMap = mkOption {
|
||||
type = types.str;
|
||||
default = "us";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,8 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.zsh;
|
||||
in
|
||||
{
|
||||
options.modules.zsh = {
|
||||
enable = mkEnableOption {
|
||||
|
|
|
|||
|
|
@ -2,29 +2,32 @@
|
|||
description = "_template package and shell environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }: let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
||||
name = builtins.baseNameOf (builtins.toString ./.);
|
||||
shellApplication = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
outputs =
|
||||
{ nixpkgs, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = nixpkgs.legacyPackages.${system}.pkgs;
|
||||
name = builtins.baseNameOf (builtins.toString ./.);
|
||||
shellApplication = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
|
||||
text = builtins.readFile ./${name}.sh;
|
||||
text = builtins.readFile ./${name}.sh;
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
unixtools.column
|
||||
];
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
unixtools.column
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.${system}.default = shellApplication;
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
packages = [ shellApplication ];
|
||||
};
|
||||
};
|
||||
in {
|
||||
packages.${system}.default = shellApplication;
|
||||
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
packages = [ shellApplication ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -2,28 +2,31 @@
|
|||
description = "install-system package and shell environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }: let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
|
||||
name = builtins.baseNameOf (builtins.toString ./.);
|
||||
shellApplication = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
outputs =
|
||||
{ nixpkgs, ... }:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
|
||||
name = builtins.baseNameOf (builtins.toString ./.);
|
||||
shellApplication = pkgs.writeShellApplication {
|
||||
inherit name;
|
||||
|
||||
text = builtins.readFile ./${name}.sh;
|
||||
text = builtins.readFile ./${name}.sh;
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
unixtools.column
|
||||
];
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
gnused
|
||||
unixtools.column
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux.default = shellApplication;
|
||||
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = [ shellApplication ];
|
||||
};
|
||||
};
|
||||
in {
|
||||
packages.x86_64-linux.default = shellApplication;
|
||||
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
packages = [ shellApplication ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue