I'm trying to override the stable nvidia package from my configuration.nix from nvidia driver 410 to 390, however, it doesn't seem to work using the override config below.
I am enabling the driver using the services.xserver.videoDrivers = [ "nvidia" ] option and am subscribed to the unstable channel.
configuration.nix:
nixpkgs.config = {
allowUnfree = true;
packageOverrides = super: let self = super.pkgs; in
{
linuxPackages = super.linuxPackages_latest.extend (self: super: {
nvidiaPackages = super.nvidiaPackages // {
stable = super.nvidiaPackages.stable_390;
};
});
};
};
I also tried changing from super to self in the following line:
stable = super.nvidiaPackages.stable_390;
But this doesn't have any affect either.
From what I've been able to figure out, you'll need to override both the linux packages and nvidia_x11 in the core package set. If I didn't, I encountered a silent fallback to the default nvidia drivers.
The following is an example that is less fine-grained than your attempt. My thinking was that there was a possibility of a mismatch between kernel dependencies used to build and loaded at runtime, so I instead swapped out the entire linuxPackage set.
At present (01/10/2019), nvidia 410.7x is broken (see Issue 53708). So I've pinned my configuration to the last commit with nvidia 410.6x. For more information on pinning nixpkgs, see the wiki page. You can still pin against master and add an unstable namespace to your package set without interfering with the kernel.
{ config, pkgs, nixpkgs, ... }:
let
# get the last working revision with nvidia 410.x
nixos-unstable-pinned = import (builtins.fetchTarball {
name = "nixos-unstable_nvidia-410-66_2018-11-03";
url = https://github.com/nixos/nixpkgs/archive/bf084e0ed7a625b50b1b0f42b98358dfa23326ee.tar.gz;
sha256 = "0w05cw9s2pa07vqy21ack7g7983ig67lhwkdn24bzah3z49c2d8k";
}) { };
# We'll use this twice
pinnedKernelPackages = nixos-unstable-pinned.linuxPackages_latest;
in
{
# allow nvidia drivers to be loaded
nixpkgs.config.allowUnfree = true;
nixpkgs.config.packageOverrides = pkgs: {
# swap out all of the linux packages
linuxPackages_latest = pinnedKernelPackages;
# make sure x11 will use the correct package as well
nvidia_x11 = nixos-unstable-pinned.nvidia_x11;
};
# line up your kernel packages at boot
boot.kernelPackages = pinnedKernelPackages;
}
Hope this helps!
Related
I'm trying to follow example of fltk application which uses openGl, but the build is not functioning:
let app = app::App::default();
let mut win = window::GlutWindow::default().with_size(800, 600);
win.set_mode(enums::Mode::Opengl3);
win.end();
win.show();
unsafe {
let gl = glow::Context::from_loader_function(|s| {
win.get_proc_address(s) as *const _
});
I get: failed to resolve: could not find GlutWindow in window.
I'm using fltk version 1
Thank you
p.s. I'm using Rust
Check your imports which are missing from that snippet.
Also if you’re not enabling the enable-glwindow feature, you should, try changing your Cargo.toml to include the missing feature:
[dependencies]
fltk = { version = "1", features = ["enable-glwindow"] }
I have written a CLI tool in Node JS and published to NPM. Every time it's run in terminal, I need the user to be notified of a new version available and its type (patch | minor | major) so that he/she can update it accordingly. How can I implement this?
Moreover, is it possible to ask the user if he/she would like to have the package updated by itself?
A new version of Rapid React is available. Would you like to update it now?(Y\n)
Version Update Check:
I would suggest using update-notifier but strangely it doesn't work. So, I chose to handle this work by myself.
The latest version can be checked easily with package-json which fetches the metadata of a package from the npm registry. Alternatively latest-version can be used as well which uses package-json under the hood.
import boxen from 'boxen';
import chalk from 'chalk';
import semver from 'semver';
import pkgJson from 'package-json';
import semverDiff from 'semver-diff';
import { capitalizeFirstLetter } from '../utils';
import { name, version } from '../../package.json';
const checkUpdate = async () => {
const { version: latestVersion } = await pkgJson(name);
// check if local package version is less than the remote version
const updateAvailable = semver.lt(version, latestVersion as string);
if (updateAvailable) {
let updateType = '';
// check the type of version difference which is usually patch, minor, major etc.
let verDiff = semverDiff(version, latestVersion as string);
if (verDiff) {
updateType = capitalizeFirstLetter(verDiff);
}
const msg = {
updateAvailable: `${updateType} update available ${chalk.dim(version)} → ${chalk.green(latestVersion)}`,
runUpdate: `Run ${chalk.cyan(`npm i -g ${name}`)} to update`,
};
// notify the user about the available udpate
console.log(boxen(`${msg.updateAvailable}\n${msg.runUpdate}`, {
margin: 1,
padding: 1,
align: 'center',
}));
}
};
Update notification:
Every time the tool runs, user would see such a notification if an update is available.
I am trying to utilize NVIM's built-in LSPs. While I've been able to implement the LSP for css and python, I haven't been successful with javascript and html.
I installed the LSPs with
:LspInstall <LSP>
Here's how I'm loading the LSPs:
packadd nvim-lspconfig
packadd completion-nvim
:lua << EOF
local nvim_lsp = require('nvim_lsp')
local on_attach = function(_, bufnr)
require('completion').on_attach()
local opts = { noremap=true, silent=true }
end
local servers = {'tsserver', 'cssls', 'html', 'pyls'}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach
}
print("lsp istalled -", lsp)
end
EOF
:LspInstallInfo shows:
{
cssls = {
bin_dir = "~/.cache/nvim/nvim_lsp/cssls/node_modules/.bin",
binaries = {
["css-languageserver"] = "~/.cache/nvim/nvim_lsp/cssls/node_modules/.bin/css-languageserver"
},
install_dir = "~/.cache/nvim/nvim_lsp/cssls",
is_installed = true
},
html = {
bin_dir = "~/.cache/nvim/nvim_lsp/html/node_modules/.bin",
binaries = {
["html-languageserver"] = "~/.cache/nvim/nvim_lsp/html/node_modules/.bin/html-languageserver"
},
install_dir = "~/.cache/nvim/nvim_lsp/html",
is_installed = true
},
tsserver = {
bin_dir = "~/.cache/nvim/nvim_lsp/tsserver/node_modules/.bin",
binaries = {
["typescript-language-server"] = "~/.cache/nvim/nvim_lsp/tsserver/node_modules/.bin/typescript
-language-server"
},
install_dir = "~/.cache/nvim/nvim_lsp/tsserver",
is_installed = true
}
}
They seem to be installed and the LSPs for *.css and *.py work fine.
When I open a *.js, *.ts, or *.html file I get the same response with the :LspInstallInfo command. However, I don't think the LSP is active because I do not receive any warning or error messages regarless of what I type.
I've tried loading the LSP different ways, including:
require'nvim_lsp'.tsserver.setup{}
require'nvim_lsp'.html.setup{}
I came across a post about installing typescript and I did, but it didn't seem to have any effect.
I've deactivated all of the other plugins and had the same results.
After installation, you should take consider root_dir. So if you don't have a matching root directory LSP doesn't launch.
In order to automatically launch a language server, lspconfig
searches up the directory tree from your current buffer to find a file
matching the root_dir pattern defined in each server's configuration.
For pyright, this is any directory containing ".git", "setup.py",
"setup.cfg", "pyproject.toml", or "requirements.txt").
Language servers require each project to have a root in order to
provide completion and search across symbols that may not be defined
in your current file, and to avoid having to index your entire
filesystem on each startup.
But if you want to launch LSP in any directory, you can use something like this for Javscript:
require'lspconfig'.tsserver.setup{
filetypes = { "typescript", "typescriptreact", "typescript.tsx" },
root_dir = function() return vim.loop.cwd() end -- run lsp for javascript in any directory
}
I was working on setting up neovim 0.5 today and landed up here looking for something else related to LSP. Anyho, I do have a working setup; here's a brief:
Install neovim nightly (>= 0.5 version)
Install nvim-lspconfig package (I used vim-plug)
Install tsserver: npm i -g typescript-language-server
Add setup in init.vim (remove EOF lines if init.lua):
lua << EOF
require'lspconfig'.tsserver.setup{}
EOF
Restart neovim
I noticed you're using commands like LspInstall & LspInstallInfo, but they are not present in my setup. I'm afraid I cannot comment of why they it work as expected.
LSP by itself doesn't show autocompletion. Have to use another plugin. I am getting good results with completion-nvim
This is a good reference : neovim-and-its-built-in-language-server-protocol
Oh, do give :help lsp a read if you haven't already. Cheers!
Using the official traceur module, is it possible to set the default options for compile and require?
For example, this code works:
var traceur = require('traceur');
console.log(
traceur.compile('{ let x = 1; }', { experimental:true }).js
);
Now if I remove traceur.compile's 2nd argument (the options object):
console.log(
traceur.compile('{ let x = 1; }').js
);
Traceur will throw an error as the blockBinding option is not enabled. Is there any way to change the default options, in order to compile files without always passing an options object?
My main concern, apart from applying the DRY principle, is getting the traceur.require function to compile files with customized options -- as far as I can see, traceur.require and traceur.require.makeDefault() do not even take an options argument.
For instance, considering this code sample:
require('traceur').require('./index');
And this piece of code:
require('traceur').require.makeDefault();
require('./index');
Is there any way to compile the required file with the experimental option enabled?
Preferably by altering the default options, as I cannot see any other viable way.
Using Node 0.10.29 and Traceur 0.0.49.
Here's a full example of what I'd like to achieve.
bootstrap.js (entry point):
var traceur = require('traceur');
traceur.options.experimental = true;
traceur.require.makeDefault();
require('./index');
index.js:
import {x} from './lib';
// using a block binding in order to check
// whether this file was compiled with experimental features enabled
{
let y = x;
console.log(y);
}
lib.js:
export var x = (() => {
if (true) {
// should be compiled with experimental features enabled too
let x = 1;
return x;
}
})();
Expected console output: 1
traceur.options.experimental=true serves as a setter which enables the experimental features in the traceur.options object, but unfortunately traceur.options does not seem to affect traceur.compile nor traceur.require as far as I can see.
The Using Traceur with Node.js Wiki page does not mention anything about compiling options. The Options for Compiling page does not mention the Traceur API in Node.js, in fact, I cannot find any documentation about the Traceur API in Node.js.
Fabrício Matté ;-) added support for giving the default options to makeDefault(), see
https://github.com/google/traceur-compiler/blob/master/src/node/require.js#L58
A separate bug with the option experimental was fixed today, 16JUL14.
I'm trying so set up a NixOS VM for code development in haskell, and got into troubles with the basic installation of both xmonad and emacs. The relevant part of my /etc/nixos/configuration.nix is
environment.systemPackages = with pkgs; [
emacs
emacs24Packages.haskellMode
xlibs.xmessage
haskellPackages.haskellPlatform.ghc
haskellPackages.xmobar
haskellPackages.xmonad
haskellPackages.xmonadContrib
haskellPackages.xmonadExtras
];
xmonad: when I try to compile the code, xmonad complains that it couldn't find the module XMonad.Util.EZConfig.
Compiling xmonad.hs with ghc is ok, and I'm also able to load the module into ghci.
On the #nixos channel, I was told to use the function ghcWithPackages, but I wasn't able to correct the problem. Moreover, I'd like to understand why there is this problem in the first place, as it seems to me that this is a very simple use case. A minimal xmonad.hs with which I have the problem is:
import XMonad
import XMonad.Util.EZConfig
main = xmonad $ defaultConfig
{ modMask = mod4Mask
, terminal = "konsole"
}
`additionalKeysP`
[ ("M-e", spawn "emacs")
, ("M-f", spawn "firefox")
]
emacs: after the installation of the package haskellmode (look at the configuration.nix above), I'm not able to enter haskell-mode in emacs.
I put together these problems as I suspect they're both caused by a fundamental incomprehension of something on my behalf, so the cause may be common.
just add
windowManager.xmonad.enableContribAndExtras = true;
to
/etc/nixos/configuration.nix
Then start xmonad the usual way through your .xsession file
I can't add comment for now... But I think it's a problem with cabal local and global repositories.
As I see, "Nix allows users to install packages without requiring root privileges, and provides each user with its own view of the set of installed packages. Multiple versions of a program or library can be installed at the same time. Package upgrades are atomic and can be rolled back."
Maybe you can use ghc-pkg list to see if, in root and normal user, the packages are well installed.
I am unsure why you're unable to compile that... I can't offer a solution, but personally, I am able to compile my XMonad config which includes
import XMonad.Util.EZConfig
This is the relevant lines in my configuration.
environment.systemPackages = with pkgs; [
haskellPackages.xmobar
haskellPackages.xmonad
haskellPackages.xmonad-contrib
haskellPackages.xmonad-extras
];
programs.dconf.enable = true;
services = {
dbus = {
enable = true;
packages = [ pkgs.dconf ];
};
xserver = {
enable = true;
libinput = {
enable = true;
touchpad.disableWhileTyping = true;
};
serverLayoutSection = ''
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
'';
displayManager = {
defaultSession = "none+xmonad";
lightdm.enable = true;
lightdm.greeters.mini.enable = true;
};
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
};
xkbOptions = "caps:ctrl_modifier";
};
};
env = {
XMONAD_CONFIG_DIR = "$XDG_CONFIG_HOME/xmonad";
XMONAD_CACHE_DIR = "$XDG_CONFIG_HOME/xmonad";
XMONAD_DATA_DIR = "$XDG_CONFIG_HOME/xmonad";
};
As someone pointed out, it might be because you don't have the line:
enableContribAndExtras = true;
I posted my configuration also so you could see how this would tie into a more extensive configuration, in this case for lightdm.