Rewrite using flake-parts #18

Closed
Daholli wants to merge 5 commits from rewrite into main
5 changed files with 232 additions and 16 deletions
Showing only changes of commit d579c8ad2c - Show all commits

View file

@ -4,22 +4,59 @@
stateVersion = "25.05";
in
{
homeManager.base = {
home = {
inherit stateVersion;
};
};
homeManager.base =
{
config,
inputs,
...
}:
{
imports = [
inputs.sops-nix.homeManagerModules.sops
inputs.catppuccin.homeModules.catppuccin
];
nixos.base = {
system = {
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://search.nixos.org/options?&show=system.stateVersion&from=0&size=50&sort=relevance&type=packages&query=stateVersion).
inherit stateVersion;
home = {
inherit stateVersion;
};
};
nixos.base =
{
config,
inputs,
pkgs,
...
}:
{
imports = [
inputs.sops-nix.nixosModules.sops
inputs.catppuccin.nixosModules.catppuccin
];
environment.systemPackages = with pkgs; [
sops
age
ssh-to-age
];
sops = {
defaultSopsFile = ../../../secrets/secrets.yaml;
defaultSopsFormat = "yaml";
# age.keyFile = "/home/cholli/.config/sops/age/keys.txt";
age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
};
system = {
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://search.nixos.org/options?&show=system.stateVersion&from=0&size=50&sort=relevance&type=packages&query=stateVersion).
inherit stateVersion;
};
};
};
};
}

View file

@ -0,0 +1,155 @@
{
flake.modules = {
nixos.base =
{
inputs,
pkgs,
...
}:
let
helix-pkg = inputs.helix.packages.${pkgs.system}.default;
in
{
environment = {
systemPackages = [
helix-pkg
];
};
};
homeManager.base =
{ inputs, pkgs, ... }:
let
helix-pkg = inputs.helix.packages.${pkgs.system}.default;
in
{
home.file.".config/helix/ignore".text = ''
.idea/
!**/appsettings.json
.direnv/
.devenv/
'';
catppuccin.helix.enable = true;
programs.helix = {
enable = true;
package = helix-pkg;
defaultEditor = true;
settings = {
editor = {
auto-format = true;
line-number = "relative";
file-picker = {
hidden = false;
};
lsp = {
display-inlay-hints = true;
display-messages = true;
};
cursor-shape = {
normal = "block";
insert = "bar";
select = "underline";
};
indent-guides = {
render = true;
character = "|";
};
statusline = {
left = [
"mode"
"spinner"
];
center = [ "file-name" ];
right = [
"workspace-diagnostics"
"diagnostics"
"selections"
"position"
"total-line-numbers"
"spacer"
"file-encoding"
"file-line-ending"
"file-type"
];
separator = "";
};
};
keys = {
normal = {
esc = [
"collapse_selection"
"keep_primary_selection"
];
space = {
space = "file_picker";
};
C-j = (builtins.genList (_: "move_line_down") 5) ++ [ "align_view_center" ];
C-k = (builtins.genList (_: "move_line_up") 5) ++ [ "align_view_center" ];
};
};
};
languages = {
language = [
{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
language-servers = [
"nixd"
"nil"
];
}
{
# provided by the dev environment in the rust shell
name = "rust";
auto-format = true;
formatter.command = "cargo fmt";
language-servers = [ "rust-analyzer" ];
}
];
language-server = {
nixd = {
command = "${pkgs.nixd}/bin/nixd";
};
marksman = {
command = "${pkgs.marksman}/bin/marksman";
};
vscode-json-language-server = {
command = "${pkgs.vscode-langservers-extracted}/bin/vscode-json-language-server";
args = [ "--stdio" ];
config.provideFormatter = true;
config.json.validate.enable = true;
};
vscode-html-language-server = {
command = "${pkgs.vscode-langservers-extracted}/bin/vscode-html-language-server";
args = [ "--stdio" ];
config.provideFormatter = true;
};
vscode-css-language-server = {
command = "${pkgs.vscode-langservers-extracted}/bin/vscode-css-language-server";
args = [ "--stdio" ];
config.provideFormatter = true;
};
vscode-eslint-language-server = {
command = "${pkgs.vscode-langservers-extracted}/bin/vscode-eslint-language-server";
args = [ "--stdio" ];
config.provideFormatter = true;
};
};
};
};
};
};
}

View file

@ -1,4 +1,6 @@
{ inputs, ... }:
{
imports = [ inputs.flake-parts.flakeModules.modules ];
imports = [
inputs.flake-parts.flakeModules.modules
];
}

View file

@ -37,8 +37,11 @@
"wheel"
];
shell = pkgs.fish;
# TODO: fix this with sops
initialPassword = "asdf";
};
nix.settings.trusted-users = [ config.flake.meta.users.cholli.username ];
};
};
}

View file

@ -0,0 +1,19 @@
{
config,
...
}:
{
flake = {
modules.nixos.root =
{ pkgs, ... }:
{
programs.fish.enable = true;
users.users.root = {
shell = pkgs.fish;
openssh.authorizedKeys.keys = config.flake.meta.users.cholli.authorizedKeys;
initialPassword = "asdf1234";
};
};
};
}