refac: use nix apps instead of gnumake

This commit is contained in:
Dmitriy Pleshevskiy 2022-10-09 14:56:08 +03:00
parent 457394ea22
commit 8d29c548ba
Signed by: pleshevskiy
GPG Key ID: 1B59187B161C0215
7 changed files with 46 additions and 36 deletions

View File

@ -306,7 +306,9 @@
},
"nil": {
"inputs": {
"flake-utils": "flake-utils",
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
],
@ -446,6 +448,7 @@
"root": {
"inputs": {
"dedsec-grub-theme": "dedsec-grub-theme",
"flake-utils": "flake-utils",
"hardware": "hardware",
"home-manager": "home-manager",
"myneovim": "myneovim",

View File

@ -2,6 +2,8 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
hardware.url = "github:NixOS/nixos-hardware/master";
home-manager = {
@ -23,6 +25,7 @@
nil = {
url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
# my neovim configuration
@ -38,11 +41,44 @@
};
};
outputs = inputs @ { self, nixpkgs, hardware, ... }:
let
system = "x86_64-linux";
in
{
outputs = inputs @ { self, flake-utils, nixpkgs, hardware, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib;
nixos-rebuild = pkgs.nixos-rebuild.override { nix = pkgs.nixFlakes; };
in
{
apps = lib.mapAttrs
(name: program: { type = "app"; program = toString program; })
(
(flake-utils.lib.flattenTree {
switch = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "switch-${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild switch --flake .#${hostname}
'')
self.nixosConfigurations);
})
// {
fix-systemd = pkgs.writeShellScript "fix-systemd" ''
systemctl --user reset-failed
'';
}
);
devShells = {
default = pkgs.mkShell {
packages = with pkgs;
[
stylua # lua formatter
ormolu # haskell formatter
];
};
};
})
// {
nixosConfigurations =
nixpkgs.lib.mapAttrs
(hostname: { system
@ -61,18 +97,5 @@
++ extraModules;
})
(import ./machines inputs);
devShells.${system} =
let
pkgs = import nixpkgs { inherit system; };
in
{
default = pkgs.mkShell {
packages = with pkgs; [
stylua # lua formatter
ormolu # haskell formatter
];
};
};
};
}

View File

@ -14,7 +14,7 @@ in
];
};
asus_gl553vd = {
asus-gl553vd = {
system = "x86_64-linux";
specialArgs = {

View File

@ -1,11 +0,0 @@
switchSys = nixos-rebuild switch --flake
sys-home:
sudo ${switchSys} .#home
sys-asus-gl553vd:
sudo ${switchSys} .#asus_gl553vd
fix-systemd:
systemctl --user reset-failed

View File

@ -6,11 +6,6 @@ in
{
imports = (import ./ui) ++ (import ./shell) ++ (import ./progs);
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = secrets.userName;
home.homeDirectory = secrets.userDir;
home.keyboard = {
model = "pc105";
layout = "us,ru";