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": { "nil": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": [
"flake-utils"
],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
@ -446,6 +448,7 @@
"root": { "root": {
"inputs": { "inputs": {
"dedsec-grub-theme": "dedsec-grub-theme", "dedsec-grub-theme": "dedsec-grub-theme",
"flake-utils": "flake-utils",
"hardware": "hardware", "hardware": "hardware",
"home-manager": "home-manager", "home-manager": "home-manager",
"myneovim": "myneovim", "myneovim": "myneovim",

View file

@ -2,6 +2,8 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
hardware.url = "github:NixOS/nixos-hardware/master"; hardware.url = "github:NixOS/nixos-hardware/master";
home-manager = { home-manager = {
@ -23,6 +25,7 @@
nil = { nil = {
url = "github:oxalica/nil"; url = "github:oxalica/nil";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
}; };
# my neovim configuration # my neovim configuration
@ -38,11 +41,44 @@
}; };
}; };
outputs = inputs @ { self, nixpkgs, hardware, ... }: outputs = inputs @ { self, flake-utils, nixpkgs, hardware, ... }:
let flake-utils.lib.eachDefaultSystem
system = "x86_64-linux"; (system:
in 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 = nixosConfigurations =
nixpkgs.lib.mapAttrs nixpkgs.lib.mapAttrs
(hostname: { system (hostname: { system
@ -61,18 +97,5 @@
++ extraModules; ++ extraModules;
}) })
(import ./machines inputs); (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"; system = "x86_64-linux";
specialArgs = { 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); 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 = { home.keyboard = {
model = "pc105"; model = "pc105";
layout = "us,ru"; layout = "us,ru";