Update flake for COSMIC itself

This commit is contained in:
Aaron Honeycutt 2023-12-05 16:34:21 -07:00
parent ba54f1eb98
commit e9ec1a1482
4 changed files with 44 additions and 223 deletions

View file

@ -1,137 +0,0 @@
{
"nodes": {
"crane": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1698166613,
"narHash": "sha256-y4rdN4flxRiROqNi1waMYIZj/Fs7L2OrszFk/1ry9vU=",
"owner": "ipetkov",
"repo": "crane",
"rev": "b7db46f0f1751f7b1d1911f6be7daf568ad5bc65",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1698906096,
"narHash": "sha256-xXsjyprR3xhv7V+0Tf4IDFEbGafwAvoK40900UYLkDY=",
"owner": "nix-community",
"repo": "fenix",
"rev": "2634e2ffc5501957922285a87a83e430d8bc29cb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1694857738,
"narHash": "sha256-bxxNyLHjhu0N8T3REINXQ2ZkJco0ABFPn6PIe2QUfqo=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "41fd48e00c22b4ced525af521ead8792402de0ea",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1698890957,
"narHash": "sha256-DJ+SppjpPBoJr0Aro9TAcP3sxApCSieY6BYBCoWGUX8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c082856b850ec60cda9f0a0db2bc7bd8900d708c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"fenix": "fenix",
"flake-utils": "flake-utils",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1698762780,
"narHash": "sha256-WzuwMjpitp41dacdNzrdGjjP72Z0fFyGuQR2PJk48pE=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "99e94d2938a743f8f48c6b729de4c517eeced99d",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,86 +0,0 @@
{
description = "Text Editor application for the COSMIC desktop environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, nix-filter, crane, fenix }:
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.stable.toolchain;
crateNameFromCargoToml = craneLib.crateNameFromCargoToml {cargoToml = ./Cargo.toml;};
pkgDef = {
inherit (crateNameFromCargoToml) pname version;
src = nix-filter.lib.filter {
root = ./.;
include = [
./src
./Cargo.toml
./Cargo.lock
./i18n
./i18n.toml
./justfile
];
};
nativeBuildInputs = with pkgs; [
gtk3
just
pkg-config
autoPatchelfHook
];
buildInputs = with pkgs; [
systemdMinimal
bashInteractive
libxkbcommon
freetype
fontconfig
expat
lld
desktop-file-utils
stdenv.cc.cc.lib
libinput
];
};
cargoArtifacts = craneLib.buildDepsOnly pkgDef;
cosmic-edit= craneLib.buildPackage (pkgDef // {
inherit cargoArtifacts;
});
in {
checks = {
inherit cosmic-edit;
};
apps.default = flake-utils.lib.mkApp {
drv = cosmic-edit;
};
packages.default = cosmic-edit.overrideAttrs (oldAttrs: rec {
installPhase = ''
just prefix=$out install
'';
});
devShells.default = pkgs.mkShell rec {
inputsFrom = builtins.attrValues self.checks.${system};
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath (builtins.concatMap (d: d.runtimeDependencies) inputsFrom);
};
});
nixConfig = {
# Cache for the Rust toolchain in fenix
extra-substituters = [ "https://nix-community.cachix.org" ];
extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
};
}

44
flakes/COSMIC/flake.nix Normal file
View file

@ -0,0 +1,44 @@
{
description = "COSMIC Development Environment";
inputs = {
nixpkgs = {url = "github:NixOS/nixpkgs/nixpkgs-unstable";};
flake-utils = {url = "github:numtide/flake-utils";};
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
inherit (nixpkgs.lib) optional;
pkgs = import nixpkgs {inherit system;};
fhs = pkgs.buildFHSUserEnv {
name = "COSMIC";
targetPkgs = pkgs: (with pkgs; [
# There is a lot here, because I am not sure about your system. :)
xorg.libX11
xorg.libXext
xorg.libxcb
udev
#runScript = "bash -c ./pico8";
};
in {
devShell = pkgs.mkShell {
buildInputs = with pkgs; [
fhs
];
shellHook = ''
if [ -e pico8 ]
then
tput setaf 2; echo "Pico-8 binary present. Type 'pico8' to get started."; tput sgr0;
else
tput setaf 3; echo "No Pico-8 binary present. Please download it."; tput sgr0;
echo "You can purchase it here:"
tput setaf 2; echo "https://www.lexaloffle.com/pico-8.php"; tput sgr0;
fi
'';
};
});
}